Can I process each record of a BO, based on the records found in a query of another BO? SO the process would be to Run a query of BO_A and filter down to the records you want. Each of these records contain a key field. Now based the this query results, find records in a second BO_B where BO_B. Key_field = BO_A.Key_field and set another field in BO B.
BO_A.Key_Field
BO_A.Description
BO_A.System
BO_A.Account
BO_A.Key_Field
BO_B.Category
Query BO_A and filter down to the records you want by Description, System, Account ect. Now using the results find each record in BO_B wher the Key Fields match and set the Category in BO_B to some value.
I've managed to pass the filtered BO_A to a process. FInd BO_B based on the key field and update the category. but only for the first record. Not all the records in the passed query results.
perform process on BO_B Based on Query Results of BO_A
-
- Posts: 139
- Joined: Sat Feb 10, 2018 12:56 am
-
- Posts: 1460
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: perform process on BO_B Based on Query Results of BO_A
Your example is very abstract, so it's difficult to understand what's going on.
Are you trying to achieve all of this in a single process? If so then the behaviour that you've described is as expected.
If you have a set of found records and then want to process those against another set of records you need to create a second process with an input of the results of the first query
Example
ProcessFindBOA
ProcessUpdateBOB input BOA
Are you trying to achieve all of this in a single process? If so then the behaviour that you've described is as expected.
If you have a set of found records and then want to process those against another set of records you need to create a second process with an input of the results of the first query
Example
ProcessFindBOA
Code: Select all
Find BOA where BOA.System='XYZ'
ProcessUpdateBOB
Code: Select all
Find BOB where BOB.Key=BOA.System
BOB.Attribute ='123'
Last edited by PointsWell on Wed Jun 16, 2021 11:02 pm, edited 1 time in total.
-
- Posts: 139
- Joined: Sat Feb 10, 2018 12:56 am
Re: perform process on BO_B Based on Query Results of BO_A
On the right track, I did separate the processes. But the first step is actually running a query and letting the user filter it down to the records they want. So I have the query results on the screen with a button in the tool bar to start the process. I do input the BOA of the query.
-
- Posts: 1460
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: perform process on BO_B Based on Query Results of BO_A
A better example or the actual code would be helpful as it's not clear what you are doing.
-
- Posts: 139
- Joined: Sat Feb 10, 2018 12:56 am
Re: perform process on BO_B Based on Query Results of BO_A
I'll try to draw it up, but basically - you run a query and
1. You run a query against BOA. The user uses that query to filter down to the group of records they want.
2. You want to set a field in another Business Object (BOB) based on this group using the OBJECT_ID (Key field) that is in both BO's.
How I have it setup.
Run BOA Query and continue to filter to the desired group. this will be the Objects Identifiers you want to update in the second BO.
In the tool bar select "RECLASS" button that starts process "Reclass" with input BOA.
Reclass Process (input BOA).
Rule 1. Open form to store the Category value you want to set in the LoggedInRegularUser.CATEGORY attribute.
Rule 2 action 1. FIND BOB WHERE BOB.OBJ_ID=BOA.OBJ_ID
Step 2 action 2. BOB.CATEGORY=LoggedInRegularUser.CATEGORY
This works, but only for the first record of BOA.
1. You run a query against BOA. The user uses that query to filter down to the group of records they want.
2. You want to set a field in another Business Object (BOB) based on this group using the OBJECT_ID (Key field) that is in both BO's.
How I have it setup.
Run BOA Query and continue to filter to the desired group. this will be the Objects Identifiers you want to update in the second BO.
In the tool bar select "RECLASS" button that starts process "Reclass" with input BOA.
Reclass Process (input BOA).
Rule 1. Open form to store the Category value you want to set in the LoggedInRegularUser.CATEGORY attribute.
Rule 2 action 1. FIND BOB WHERE BOB.OBJ_ID=BOA.OBJ_ID
Step 2 action 2. BOB.CATEGORY=LoggedInRegularUser.CATEGORY
This works, but only for the first record of BOA.
Re: perform process on BO_B Based on Query Results of BO_A
this is the typical issue...
either add "IN BATCHES OF 1" to the FIND BOB (slower)
OR call a subprocess with input BOB to receive the pointers of the found BOBs, and apply the update there
either add "IN BATCHES OF 1" to the FIND BOB (slower)
OR call a subprocess with input BOB to receive the pointers of the found BOBs, and apply the update there
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: perform process on BO_B Based on Query Results of BO_A
Looks like a bug to me.
I believe the following is similar to what KnightWare describes
I have a query that finds some A records.
This query has a "Panel Operation" that Starts Process "CountKeys" and "Applicable to multiple items" is selected.
I run the query and filter the results to get the desired A records.
After selecting 2 records I execute the "Panel Operation" that starts the process "CountKeys"
Here is the code for the CountKeys Process (which has A as input):
Here is the logs from executing the CountKeys process:
I believe the following is similar to what KnightWare describes
I have a query that finds some A records.
This query has a "Panel Operation" that Starts Process "CountKeys" and "Applicable to multiple items" is selected.
I run the query and filter the results to get the desired A records.
After selecting 2 records I execute the "Panel Operation" that starts the process "CountKeys"
Here is the code for the CountKeys Process (which has A as input):
Code: Select all
FIND B WHERE B.KeyID=A.KeyID
INCREASE B.CountKeys BY 1
Here is the logs from executing the CountKeys process:
Notice that two A records are passed into the process, but only one is processed.-20 Executing process CountKeys with parameters: A:3A:4
-29 Started evaluation of rules
-22 Evaluating rule 'FindB' FIND B WHERE B.KeyID=A.KeyID
-2 Adding action FIND B WHERE B.KeyID=A.KeyID to the agenda
-16 Finished rule evaluation
-16 Finished evaluation of rules
-15 Executing action FIND B WHERE B.KeyID=A.KeyID
-33 Found 1 objects
-16 Finished executing action FIND B WHERE B.KeyID=A.KeyID
-25 Started evaluation of rules after data has been changed by the actions
-6 Checking rule FindB
-16 Finished evaluation of rules after data has been changed by the actions
-29 Started evaluation of rules
-22 Evaluating rule 'IncreaseCount' INCREASE B.CountKeys BY 1
-2 Adding action INCREASE B.CountKeys BY 1 to the agenda
-16 Finished rule evaluation
-16 Finished evaluation of rules
-15 Executing action INCREASE B.CountKeys BY 1
-4 CountKeys=1
-30 Starting execution of rules when updating business object B 6
-29 Started evaluation of rules
-22 Evaluating rule 'Initial value for B.CountKeys' If B.CountKeys IS UNDEFINED Then B.CountKeys=0
-6 Evaluating condition B.CountKeys IS UNDEFINED
-7 Condition evaluated to false: 1
-16 Finished rule evaluation
-16 Finished evaluation of rules
-16 Finished execution of rules when updating business object B 6
-16 Finished executing action INCREASE B.CountKeys BY 1
-25 Started evaluation of rules after data has been changed by the actions
-6 Checking rule IncreaseCount
-16 Finished evaluation of rules after data has been changed by the actions
-16 Finished executing process CountKeys
Bob
Re: perform process on BO_B Based on Query Results of BO_A
I still think it is a bug, but here is a work around.
I assume you have a ReClass operation on you query. If so, remove it because it is no longer needed.
Create a new process with the first rule as
PICK ONE OR MORE FROM <the name of your existing query>
The next rule would be
ReClass
When you run this new process, your existing query will run and you can do any filtering that is needed.
Select the required records in the query and press the "continue" button.
The ReClass process will be executed for each selected records.
I assume you have a ReClass operation on you query. If so, remove it because it is no longer needed.
Create a new process with the first rule as
PICK ONE OR MORE FROM <the name of your existing query>
The next rule would be
ReClass
When you run this new process, your existing query will run and you can do any filtering that is needed.
Select the required records in the query and press the "continue" button.
The ReClass process will be executed for each selected records.
Bob
Re: perform process on BO_B Based on Query Results of BO_A
I just reread this.KnightWare wrote: ↑Thu Jun 17, 2021 4:42 pm I'll try to draw it up, but basically - you run a query and
1. You run a query against BOA. The user uses that query to filter down to the group of records they want.
2. You want to set a field in another Business Object (BOB) based on this group using the OBJECT_ID (Key field) that is in both BO's.
How I have it setup.
Run BOA Query and continue to filter to the desired group. this will be the Objects Identifiers you want to update in the second BO.
In the tool bar select "RECLASS" button that starts process "Reclass" with input BOA.
Reclass Process (input BOA).
Rule 1. Open form to store the Category value you want to set in the LoggedInRegularUser.CATEGORY attribute.
Rule 2 action 1. FIND BOB WHERE BOB.OBJ_ID=BOA.OBJ_ID
Step 2 action 2. BOB.CATEGORY=LoggedInRegularUser.CATEGORY
This works, but only for the first record of BOA.
Is the user really doing a EDIT or VIEW to look at the BOA data?
If Yes, my work around does not work. I am not even sure it can be done.
Why are you looking at it? Are there multiple Categories and the user has to pick 1??
Bob
-
- Posts: 139
- Joined: Sat Feb 10, 2018 12:56 am
Re: perform process on BO_B Based on Query Results of BO_A
The PICK ONE OR MORE... Displays the query, but just a close button, no Continue.
Re: perform process on BO_B Based on Query Results of BO_A
No Continue hmmm.KnightWare wrote: ↑Thu Jun 17, 2021 10:18 pm The PICK ONE OR MORE... Displays the query, but just a close button, no Continue.
I don't know.
Bob
Re: perform process on BO_B Based on Query Results of BO_A
If the category is the same for all the selected group of BOA'a then try this (you don't need a reclass button)KnightWare wrote: ↑Thu Jun 17, 2021 4:42 pm I'll try to draw it up, but basically - you run a query and
1. You run a query against BOA. The user uses that query to filter down to the group of records they want.
2. You want to set a field in another Business Object (BOB) based on this group using the OBJECT_ID (Key field) that is in both BO's.
How I have it setup.
Run BOA Query and continue to filter to the desired group. this will be the Objects Identifiers you want to update in the second BO.
In the tool bar select "RECLASS" button that starts process "Reclass" with input BOA.
Reclass Process (input BOA).
Rule 1. Open form to store the Category value you want to set in the LoggedInRegularUser.CATEGORY attribute.
Rule 2 action 1. FIND BOB WHERE BOB.OBJ_ID=BOA.OBJ_ID
Step 2 action 2. BOB.CATEGORY=LoggedInRegularUser.CATEGORY
This works, but only for the first record of BOA.
Process 1
Enter new [Non Persistent Business Object] (allows user to enter a Category in an NPBO attribute of the correct type)
PICK ONE OR MORE FROM [Some Query]
Process 2
Process 2 (input NPBO, BOA)
FIND BOB WHERE BOB.OBJ_ID=BOA.OBJ_ID
BOB.CATEGORY=NPBO.[Attribute containing the category]
Rocketman
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
-
- Posts: 139
- Joined: Sat Feb 10, 2018 12:56 am
Re: perform process on BO_B Based on Query Results of BO_A
Rocketman - pretty much exactly how I have it set. I am storing the value in an attribute of LoggedInRegularUser.Category. I did not pass that along because I thought it was persistant, so always available. Let me check this out.
-
- Posts: 139
- Joined: Sat Feb 10, 2018 12:56 am
Re: perform process on BO_B Based on Query Results of BO_A
When using the "PICK ONE OR MORE FROM Query", the query is all screwed up. Columns all out of order and some missing. You have to check every row as there is not a select all. And then that doesn't work, check a second box and the first one disappears and so on. You can only select one at a time.
Re: perform process on BO_B Based on Query Results of BO_A
Are you using a previously created query?
Create a query let’s say we call it queryboa
Set the displayed columns, groups, filters etc as you normally would.
Then the line is:
Pick One or more from queryboa
If this doesn’t work, there’s a bug or corruptionin the version you are using - try a re-install
Create a query let’s say we call it queryboa
Set the displayed columns, groups, filters etc as you normally would.
Then the line is:
Pick One or more from queryboa
If this doesn’t work, there’s a bug or corruptionin the version you are using - try a re-install
Rocketman
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5