PDA

View Full Version : External Data files record count


Hawk
July 29th, 2011, 07:37 AM
I am using recordWalker to display data from an external data file. How can I display the number of records returned? I able to count all of the records in the file. I need to count just the records where customerID is equal to customer ID in the External Data files.

Thanks,
Larry

step
July 29th, 2011, 08:22 AM
Could you just push them into an array based on whether or not the customerIDs from the internal and external data files match and then return the length of the array?

Hawk
July 29th, 2011, 10:15 AM
I an trying what was suggested, but only getting a return value of 1.

Here is the code.


var ProdCount = "";
var numRecsExtDF = XDF5.recordCount;
for (recordWalker=1; recordWalker <= numRecsExtDF; recordWalker++)
{
if (XDF5.GetFieldValue(recordWalker, 1) == Field("licenseid"))
{
ProdCount += recordWalker + ','
}
}
myCount +=''
var myarray = [ProdCount];
return (myarray.length);


If I return ProdCount and use that value as the array it works, but if I use the variable it counts it all as 1.

Thanks,
Larry

Dan Korn
August 1st, 2011, 07:27 AM
You have it right here:

var numRecsExtDF = XDF5.recordCount;

You don't need to do any other calculations. Just return XDF5.recordCount (or numRecsExtDF).

This simply creates an array with one item:
var myarray = [ProdCount];

Which is why myarray.length is, of course, 1.

Dan Korn
August 1st, 2011, 08:56 AM
If you want to return the number of matching records, do this:
var ProdCount = 0;
for (var i = 1; i <= XDF5.recordCount; i++)
{
if (XDF5.GetFieldValue(i, 1) == Field("licenseid"))
ProdCount++;
}
return ProdCount;