sschardan Posted December 6, 2013 Share Posted December 6, 2013 I have a job using an external data source that is a lookup table containing information about taxing authorities for a county. I was initially looping through the data to find the necessary info like this: numRecsExtDF = externalDF.recordCount; for (recordWalker=1; recordWalker <= numRecsExtDF; recordWalker++) { if (externalDF.GetFieldValue(recordWalker, 'Taxing Authority') == "Library") { info = externalDF.GetFieldValue(recordWalker, 'Contact Number'); } } return info; As the build progressed for different information returned, it became inefficient, so I changed it to FindRecord instead, like so: FoundRecord = externalDF.FindRecord('Taxing Authority', "Library") info = externalDF.GetFieldValue(FoundRecord, 'Contact Number'); return info; That is working, but I am stuck when I need to find a record based on matching two or more fields in the external data. So, how can I use FindRecord instead of using the following loop? numRecsExtDF = externalDF.recordCount; for (recordWalker=1; recordWalker <= numRecsExtDF; recordWalker++) { if ((externalDF.GetFieldValue(recordWalker, 'Taxing Authority') == "Ambulance") && (externalDF.GetFieldValue(recordWalker, 'Sub Category') == "Operating")) { info = externalDF.GetFieldValue(recordWalker, '2013 Proj Rate'); } } Thank you Quote Link to comment Share on other sites More sharing options...
step Posted December 6, 2013 Share Posted December 6, 2013 (edited) Maybe put the 'for' loop within a 'while' loop so that it will stop running as soon as it finds a value for "info"? do { numRecsExtDF = externalDF.recordCount; for (recordWalker=1; recordWalker <= numRecsExtDF; recordWalker++) { if ((externalDF.GetFieldValue(recordWalker, 'Taxing Authority') == "Ambulance") && (externalDF.GetFieldValue(recordWalker, 'Sub Category') == "Operating")) { info = externalDF.GetFieldValue(recordWalker, '2013 Proj Rate'); } } } while (info == ""); Edited December 6, 2013 by step Forgot closing code tag Quote Link to comment Share on other sites More sharing options...
sschardan Posted December 9, 2013 Author Share Posted December 9, 2013 That works, thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.