How Boolean Assignment is done with respect to another assignment

I am troubleshooting a server action which is as shown below: It gets an Item Identifier and has Variable as Output Parameter. Let me explain the server action and where I am confused.

It has an aggregate where it uses the Item Identifier to fetch results. It has one result. Then it checks for any records were returned. As it has one result, True part of the condition is executed. Then it iterates the list. It has one result. (Here starts my queries). It has an If condition where it checks for value of Variable. Since Variable has a default value of True, True = False is False and False part executes.Here clearly see the Set Variable assignment.

Variable = GetItemByItemId.List.ItemChangexxxx.Column = True

What is the value assigned to Variable? How is this assigned? 

FYI: The output of this server action is False. The value present in the ItemChangexxx.Column is 0 (in oracle database after this action is completed. so above assignment is also not performed)

Could anyone please explain how the assignments are done in the above

Hi,

On that assign you are doing what happen is this "Variable = (GetItemByItemId.List.ItemChangexxxx.Column = True)" this means if column is false the variable will be set to false if column is true variable will be set to true. Since the column is 0 the final value of variable is false.

If you want to assign true to variable and GetItemByItemId.List.ItemChangexxxx.Column you need to do 2 different assigns.

Regards,

Marcelo

Hi Somesh,


I am not sure I really can follow your explanation. Is it possible for you to upload a sample so that we can see it in action and better help you?


Thanks

Solution

Hello Somesh, 

This part of the selected assign

GetItemByItemId.List.ItemChangexxxx.Column = True

Is a comparison. So, what you are putting inside Variable is not True, but the result of that comparison. 

Also, even if you use an assignment to effectively put True in the current of the aggregate, this is being done in memory only. 

To persist in database, you need to use this record as source of an Update entity action (for example). 

Not sure if I understood your question... 

Cheers 

Solution

Eduardo Jauch wrote:

Hello Somesh, 

This part of the selected assign

GetItemByItemId.List.ItemChangexxxx.Column = True

Is a comparison. So, what you are putting inside Variable is not True, but the result of that comparison. 

Also, even if you use an assignment to effectively put True in the current of the aggregate, this is being done in memory only. 

To persist in database, you need to use this record as source of an Update entity action (for example). 

Not sure if I understood your question... 

Cheers 

Thanks Eduardo and Marcelo, I am clarified. Just one more doubt. Whatever may be the length of the list, during the iteration of the first item of the list, the condition (Variable = false) is always false. Am I right? (Since the default value of Variable is True.)

Kindly clarify this one also. Thanks in advance! 


Hi Somesh, 

If default value is True, and you are comparing against false, yes, it will enter the False branch in the first time it reach the IF. 

If you change it to True inside the False branch, as the code is now it will never enter it again (in case more iterations happen). 

Cheers