| Author |
Using LoopWhile |
drumdave
Member
Posts: 43
Location:
Joined: 13.08.07 |
| Posted on 26-01-2010 12:31 |
|
|
I'm trying to create a loop expression that performs an Action List for every record in a DataTable. The Action List works fine, but I can't seem to come up with "False" condition that will end the loop. Any ideas?
Basically, the Action List compares two fields within a record and then moves to the next field. The loop then repeats the comparison and moves to the next field until all the records have been checked. But once I get to the last record I'm not sure how to tell the loop to stop. I can't use any values within the last record (such as an ID field) as an indication that I've reached the end, because I'm always adding new records, so I never know which record will be the last record when the loop expression is started.
Thanks in advance for the help! |
|
| Author |
RE: Using LoopWhile |
yw
Administrator
Posts: 670
Location: ***
Joined: 23.06.05 |
| Posted on 26-01-2010 20:14 |
|
|
|
No need to create a loop by moving record forward. You may create an action using BatchExecute method of the DataTable. This action requires an action list as its parameter. When this action is executed, the action list is executed for each record. Suppose the Datatable has 100 records, then the action list will be execute 100 times, each time the Fields property is the current row of data, CurrentRowNumber property indicates the record number, 0 indicates the first record, 1 indicates the second record, etc. |
|
| Author |
RE: Using LoopWhile |
frangonve
Member
Posts: 110
Location: Madrid (Spain) until I can live at the beach
Joined: 18.06.08 |
| Posted on 07-02-2010 02:09 |
|
|
One step more and more doubts 
Now the different labels have to show the correct values and being updated when new fields are added to the trades table and when the settings table is updated and when the system time changes.
Example:
Label17 shows the total number of trades in selected period:
if period=0 -> number of trades today
if period=X -> number of trades in the last X hours
number of trades is the number (count?) of records filtered by the >=@Date Where clause
Label17.SetText action has to be linked to the RowCount of an EasyGrid???
with Where Clause @Date.
@Date = <Today> 00:00 if period=0
@Date = Now.AddHours (-{Form1.DataSet1.Fields.Period}) if period not 0
How can the text in Label17 and the rest of labels)be refreshed as the system time changes (once per minute)?
Edited by frangonve on 07-02-2010 02:10 |
|
| Author |
RE: Using LoopWhile |
yw
Administrator
Posts: 670
Location: ***
Joined: 23.06.05 |
| Posted on 07-02-2010 03:07 |
|
|
If the data to be displayed cannot be included in a database query then Set Property action can be used to set the Text property. The question is at which events to execute such actions.
Please download a new version from http://www.limnor.com/Studio/LimnorStudioSetup.msi. EasyDataSet and EasyGrid have an event DataFilled, and an AfterQuery event, which can be used to execute Set Properties actions. |
|