Jump to content

External Data file


Recommended Posts

Hi

I'm having an issue.

take a look at my txt file

 

I'm trying to make a Credentials in the drop down view - Output of Credentials type data file.

Weird thing is i'm able to output 17 of the 19 Credentials minus the top two.

there are tabs between the drop down view and output of credential

Im just really confused why the top two will not load into my template.

 

I've attached is the data file

and here is the java script i used in fusion pro

 

any help of direction would be really appreciated

 

thanks

Andrew

 

 

 

 

/*

1. we want to get the information from the xdf

2. count the qualifications filled

3. return the proper verbage

*/

 

XDF = new ExternalDataFileEx("FR_qualifications_XDF.txt", "\t");

 

 

var credArray1 = [];

var credArray2 = [];

var qualCounter = 0;

var degreeCounter = 0;

var intro = ", et je posséde le titre de ";

var intro2 = ", et je posséde les titres de ";

 

for (j = 1; j<4; j++){

myQual = "Qualifications"+j;

for (i = 0; i < XDF.recordCount+1; i++){

qualification = XDF.GetFieldValue(i, 0);

if (Field(myQual) == qualification && Field(myQual) != ""){

credArray1[qualCounter] = XDF.GetFieldValue(i, 1);

credArray2[qualCounter] = XDF.GetFieldValue(i, 2);

if (credArray2[qualCounter] == "degree"){

degreeCounter++;

}

qualCounter++

}

}

}

 

if (qualCounter == 1){

return intro + credArray1[0]+" "+credArray2[0]+".";

} else if (qualCounter == 2){

if (credArray2[0] == credArray2[1] && credArray2[0] != "degree") // both credential endings are the same and are not "degree"

return intro2 + credArray1[0]+","+credArray1[1]+" "+credArray2[0]+"s.";

else if (credArray2[0] == credArray2[1] && credArray2[0] == "degree") // both credential endings are the same and are "degree"

return intro2 + credArray1[0]+" "+credArray2[0]+", "+credArray1[1]+" "+credArray2[1]+".";

else // both credentials are not the same

return intro2 + credArray1[0]+" "+credArray2[0]+", "+credArray1[1]+" "+credArray2[1]+".";

} else if (qualCounter == 3){

Link to comment
Share on other sites

Thanks, but I'm not sure I can analyze that complicated rule without the rest of the job.

 

At any rate, if I change the rule to this:

var XDF = new ExternalDataFileEx("FR_qualifications_XDF.txt", "\t");
var credArray1 = [];
var qualCounter = 0;

for (i = 0; i < XDF.recordCount+1; i++)
{
   credArray1[qualCounter] = XDF.GetFieldValue(i, 1);
   qualCounter++
}

return credArray1.join("\n");

It does return every line of the file.

 

So, if you're not getting the results you're expecting, there's something else wrong in your logic. Again, though, I can't figure that out without the rest of the job. And frankly, even with the entire job, this is a bit more of a complex template-building job than I can usually work on there in the context of this forum. You may need to inquire about custom consulting work.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...