Pass data from one BO to another when record not found

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
JHew
Posts: 16
Joined: Thu Jun 25, 2020 12:23 pm

Pass data from one BO to another when record not found

Post by JHew »

Hi All,

I'm trying to find a way to pass data from my 'tempory' business object, used for checking for duplicates and my main BO.

I have created a tempory BO where the data is uploaded via a CSV file. what i tried next was:

Process 1
FIND TempBO WHERE TempBO.PrimaryKey <> MainBO.PrimaryKey IN BATCHES OF 1

Process 2
CREATE MainBO FOR EACH TempBO With MainBO.Att1 = TempBO.att1, MainBO.Att2 = TempBO.att2,... MainBO.AttX = TempBO.attX

I've tried this as a standalone process and wirtten it in the update rules but have had no luck.

Does anyone know why this hasnt worked? Or have a soloution to what im trying to achieve?

Thanks!
PointsWell
Posts: 1075
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Pass data from one BO to another when record not found

Post by PointsWell »

Temporary BOs are in context only for the duration of the process that called them. I am not sure that you would have success doing a FIND

If for example you have created 5 instances of TempBO from your import and want to deal with them as singles ie to compare against existing BOs then create a second process to do the the FIND but with an input of TempBO but searching for MainBO

Process 1

Code: Select all

[your import steps and the create TempBO steps]
DoesItExistProcess
Process name: DoesItExistProcess

Code: Select all

FIND MainBO WHERE MainBO.PrimaryKey = TempBO.PrimaryKey
IF SEARCH_COUNT = 0 THEN CREATE MainBO WITH ...
You could also use NOT(EXISTS MainBO WHERE MainBO.PK=TempBO.PK but I am in the habit of using FIND and SEARCH_COUNT as It results in one less search than if you use EXISTS then FIND
JHew
Posts: 16
Joined: Thu Jun 25, 2020 12:23 pm

Re: Pass data from one BO to another when record not found

Post by JHew »

Sorry should have specified; The Import used is from the command type not the IMPORT in the process language. I need it so the end users can upload their own files.

I tried using the Doesitexistprocess in the update rules of the MainBO in the hope than when a user updates another record this process would then be triggered to update - no luck unfortunately.

Any ideas how I could perform this check after the user uploads their own CSV file?

Thanks.
Post Reply