PDA

View Full Version : Need help on a external data file


rpaterick
June 20th, 2012, 04:26 PM
I'm not grasping the external data setup. I've tried the sample file and still can't figure how it works.:o

Attached is the actual external data file(should be formatted correctly). Master Tier is the main lookup from the mail file. MT is the column header from the mail file that points to Master Tier in extern.

1st.
On Record Start
//Link to the external data file.
//The '\t' is used to indicate TAB delimited data in this external data file
externalDF = new ExternalDataFileEx('Formatted.txt', '\t');

if(externalDF.valid != true)
{
Print('Failed to link to the external data file in OnJobStart');

2nd.
Then to create the individual fields from the external data file(very basic), I get lost in the Rules.
How would you create the HotelOffer from the external data file? If I can get that to work, I can then create the rest. I'm just not getting my current code to "validate" the HotelOffer.

Also, does the mailing file and the external data file need to be in the same root as the Fusion Pro Template?

Thanks for any direction on this.:)

ThomasLewis
June 20th, 2012, 06:07 PM
This is the way I learned how to do it and I haven't had any issues with it. It is a little different than the example found in the forums though.

OnJobStart
externalDF = new ExternalDataFileEx('external proof file.txt', '\t');
return externalDF.valid;

Rule
if (FusionPro.inValidation)
Rule("OnJobStart");

i = externalDF.FindRecord("Master Tier", Field("MT"))

if (i>0 && Field("MT") != "")
{
HotelOffer = externalDF.GetFieldValue(i, "HotelOffer");
}

rpaterick
June 21st, 2012, 01:46 PM
This is the way I learned how to do it and I haven't had any issues with it. It is a little different than the example found in the forums though.

Thanks Thomas. I got an error when trying to just validate the HotelOffer though. Function doesn't return a value.

Any ideas? suggestions?

Thanks!

ThomasLewis
June 21st, 2012, 01:59 PM
If you add
return HotelOffer;
to the end of the rule it should return a value.

rpaterick
June 21st, 2012, 02:04 PM
If you add
return HotelOffer;
to the end of the rule it should return a value.

Interesting. I think I'm onto something now.....:D

I'll get back to you.

Thanks Thomas!