How would I loop thru all records in a BO, and run a process for each. I don't need to check each record, I just need the data from the current context in a process. When the process returns, onto the next record until all records have been run thru. I don't need to update the records, although I could I guess.
For Each BO Record
Start Process DoSomethingWith Current BO
Next BO Record
Loop thru BO records for process
-
- Posts: 1463
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Loop thru BO records for process
Process 1KnightWare wrote: ↑Wed Jan 06, 2021 6:57 pm How would I loop thru all records in a BO, and run a process for each. I don't need to check each record, I just need the data from the current context in a process. When the process returns, onto the next record until all records have been run thru. I don't need to update the records, although I could I guess.
For Each BO Record
Start Process DoSomethingWith Current BO
Next BO Record
Find all relevant records
If SEARCH_COUNT >0 then Run Process 2
Process 2 (input the BOs found in process 1j
Do whatever you are trying to achieve
What will happen
Process 1 will find 'n' records where n>= 0
Process 2 will receive BOs one at a time and process each BO instance to the end of whatever process hierarchy exists in and under process 2
As it finishes with the first BO is will go back to the start of Process 2 with the next BO in context until all BOs have been processed.
As long as you don't have a DISPLAY (of either a BO or a query result) then once you've processed all of the Process 2 looped activities control will revert back to Process 1 where you can carry on with other additional processing
-
- Posts: 139
- Joined: Sat Feb 10, 2018 12:56 am
Re: Loop thru BO records for process
Seems to be only operating on 1st BO record.
Process 1
FIND BO where BO.PID > 0
START PROCESS Process 2
process 2 with BO as input
Execute Program program_name BO.Field
Process 1
FIND BO where BO.PID > 0
START PROCESS Process 2
process 2 with BO as input
Execute Program program_name BO.Field
-
- Posts: 1463
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Loop thru BO records for process
I am assuming that you definitely have more than on BO where BO.PID>0KnightWare wrote: ↑Wed Jan 06, 2021 9:43 pm Seems to be only operating on 1st BO record.
Process 1
FIND BO where BO.PID > 0
START PROCESS Process 2
process 2 with BO as input
Execute Program program_name BO.Field
Test it first with a process that doesn't call a program, for example set a timestamp field or set a flag. It definitely works. The issue may lie with the EXECUTE PROGRAM.
-
- Posts: 139
- Joined: Sat Feb 10, 2018 12:56 am
Re: Loop thru BO records for process
Yes there are 25 records that would be found.
Same - only updates the first record.
Process 1
FIND BO where BO.PID > 0
START PROCESS Process 2
process 2 with BO as input
BO.PROCESS_DATE = CURRENT_TIMESTAMP
Same - only updates the first record.
Process 1
FIND BO where BO.PID > 0
START PROCESS Process 2
process 2 with BO as input
BO.PROCESS_DATE = CURRENT_TIMESTAMP
-
- Posts: 1463
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Loop thru BO records for process
You need to post an example - it definitely works.KnightWare wrote: ↑Wed Jan 06, 2021 10:27 pm Yes there are 25 records that would be found.
Same - only updates the first record.
Process 1
FIND BO where BO.PID > 0
START PROCESS Process 2
process 2 with BO as input
BO.PROCESS_DATE = CURRENT_TIMESTAMP
Re: Loop thru BO records for process
have you tried adding "IN BATCHES OF 1 " in your FIND processYes there are 25 records that would be found.
Same - only updates the first record.
-
- Posts: 1463
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Loop thru BO records for process
I would be very interested to see how you would do it otherwiseThat shouldn't be necessary
-
- Posts: 1463
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Loop thru BO records for process
Yes , but he says it doesn't work:You do it as I described above.
Yes there are 25 records that would be found.
Same - only updates the first record.
-
- Posts: 1463
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
-
- Posts: 139
- Joined: Sat Feb 10, 2018 12:56 am
Re: Loop thru BO records for process
Whats the best way to supply the example?
Screen shots of the process's?
Updates first record in External SQL table, not all of them.
BO is Called DIRT, PID is a numeric record ID
DIRT.PID > 0 should return all records. There are 25.
---------------------------------------------------------------------------------------------
Process #1 (RefreshAll)
ForAllDirt
FInd DIRT where DIRT.PID > 0
Start Process 'UpdateDate'
Process #2 (UpdateDate) with BO DIRT as Input
SetDate
DIRT.PROCESS_DATE=CURRENT_TIMESTAMP
----------------------------------------------------------------------------------------------
Screen shots of the process's?
Updates first record in External SQL table, not all of them.
BO is Called DIRT, PID is a numeric record ID
DIRT.PID > 0 should return all records. There are 25.
---------------------------------------------------------------------------------------------
Process #1 (RefreshAll)
ForAllDirt
FInd DIRT where DIRT.PID > 0
Start Process 'UpdateDate'
Process #2 (UpdateDate) with BO DIRT as Input
SetDate
DIRT.PROCESS_DATE=CURRENT_TIMESTAMP
----------------------------------------------------------------------------------------------
Re: Loop thru BO records for process
I totally agree with PointWell that this works.PointsWell wrote: ↑Wed Jan 06, 2021 9:52 pm Test it first with a process that doesn't call a program, for example set a timestamp field or set a flag. It definitely works. The issue may lie with the EXECUTE PROGRAM.
Have you looked at the AwareIM main.log?
To see how much DIRT the process 1 is actually finding, look for lines something like
Code: Select all
Executing action FIND DIRT where DIRT.PID > 0
Found 25 objects
Code: Select all
Executing process UpdateDate with parameters: DIRT:1
Bob
-
- Posts: 139
- Joined: Sat Feb 10, 2018 12:56 am
Re: Loop thru BO records for process
Looking at wrapper.log (AwareIM\Logs\Wrapper.log) i do not see anything entered as you show. I am running in test mode. I do see entries for errors when I accidentally named the process wrong. But nothing after I corrected.