cschendel
March 23rd, 2009, 09:12 AM
I would like to get a set of records back from an external table using the ExternalDataFileEx object. In all the examples I've seen, people are only pulling one record/row of data back. I would like to get all the rows that match my criteria.
Here I am able to get back the first match of the Zip Code passed by the field and return the StoreName and StoreCity -- but it repeats the same record the same amount as the myStores.recordCount. I image this is because their is no record.Next type command like in other recordset languages. So, I do I simulate that behavior?
Sample Code
var myStores = new ExternalDataFileEx("C:\\data\\Stores.txt", ",")
var strZip = Field("CustZip")
var strOutput = ""
for (var i = 1; i <= myStores.recordCount; i++)
{
strOutput += myStores.GetFieldValue(LocalShops.FindRecord("ZipID", strZip), "StoreName") + Chr(10)
strOutput += myStores.GetFieldValue(LocalShops.FindRecord("ZipID", strZip), "StoreCity") + Chr(10)
}
return strOutput
The Stores.txt file looks like;
ZipID, StoreName, StoreCity
55416, ABC Corporation, Edina
55416, EFG Inc., Saint Louis Park
55417, XYZ Companies, Minneapolis
55418, QT Corp., St. Paul
Any assistance would be great!
Thanks!
Chris
Here I am able to get back the first match of the Zip Code passed by the field and return the StoreName and StoreCity -- but it repeats the same record the same amount as the myStores.recordCount. I image this is because their is no record.Next type command like in other recordset languages. So, I do I simulate that behavior?
Sample Code
var myStores = new ExternalDataFileEx("C:\\data\\Stores.txt", ",")
var strZip = Field("CustZip")
var strOutput = ""
for (var i = 1; i <= myStores.recordCount; i++)
{
strOutput += myStores.GetFieldValue(LocalShops.FindRecord("ZipID", strZip), "StoreName") + Chr(10)
strOutput += myStores.GetFieldValue(LocalShops.FindRecord("ZipID", strZip), "StoreCity") + Chr(10)
}
return strOutput
The Stores.txt file looks like;
ZipID, StoreName, StoreCity
55416, ABC Corporation, Edina
55416, EFG Inc., Saint Louis Park
55417, XYZ Companies, Minneapolis
55418, QT Corp., St. Paul
Any assistance would be great!
Thanks!
Chris