looping through a forms datasource
Views (35229)
This will show you how to look through all of the records of a forms data source or just the selected records without affecting what is populated within the data source
How to loop through all records of a datasource with the name of InventTrans
while(localInventTrans)
{
//access fields by using localInventTrans.fieldname
itemId = localInventTrans.ItemId;
How to loop through ONLY the selected records of a datasource with the name of InventTrans. This could be used if you have a grid and want the user to select only certain records then pass those records to a class, form, method, etc...
InventTrans localInventTrans;
ItemId itemId;
//get the first selected record of the datasource and loop through all of the selected records
How to loop through all records of a datasource with the name of InventTrans
InventTrans localInventTrans = InventTrans_DS.getFirst() as InventTrans;
ItemId itemId;while(localInventTrans)
{
//access fields by using localInventTrans.fieldname
itemId = localInventTrans.ItemId;
//get the next record from the datasource
localInventTrans = InventTrans_DS.getNext() as InventTrans;
}
localInventTrans = InventTrans_DS.getNext() as InventTrans;
}
How to loop through ONLY the selected records of a datasource with the name of InventTrans. This could be used if you have a grid and want the user to select only certain records then pass those records to a class, form, method, etc...
InventTrans localInventTrans;
ItemId itemId;
//get the first selected record of the datasource and loop through all of the selected records
for(localInventTrans = InventTrans_DS.getFirst(true) ? InventTrans_DS.getFirst(true) : InventTrans_DS.cursor(); localInventTrans; localInventTrans = InventTrans_DS.getNext())
{
itemId = localInventTrans.ItemId;
{
itemId = localInventTrans.ItemId;
info(itemId);
}
}
This was originally posted here.

Like
Report
*This post is locked for comments