15
Views
6
Comments
Solved
"For each" iterating a List

Hello, I'm not sure if it's a question but I really need help with this so I really appreciate any help and tip,

At the beginning of the development, I was using the variable Status (Boolean), but now I want to use agreement_status that it's a Integer.


So my idea was to create a timer to map those values for the new variable.

The first IF: GetAgreements.List.Current.Agreement.Status = True and GetAgreements.List.Current.Agreement.agreement_status = 0  (True -> Assign the new variable the value 2 go for the next Agreement in the list)

Sorry for the mess, but basically, I want to get the list of all the Agreements that already exist and them iterate for each agreement checking 2 things, if the Status is TRUE or FALSE and checking if the agreement_status is 0 (so there is no value assigned to it yet)


I created this timer and already run it manually, but it is not working
Am I missing something? The thing that its causing me more doubts is the GetAgreements and the "For each" because I'm not sure if it's getting every agreement and validating to map the values.


Thank you! 
Appreciate any help and sorry for the bad English :P

Solution

Hi Gustavo,

Having the agreement_status as a foreign key pointing to a static entity will make it easier to refer to a certain status in the code, or to change it's label for example.

As for your initial question, you are missing something basic here. The assign does not perform an actual database operation. To make the assign reflect in the database, you need to add an (CreateOr)Update of the Agreement record after the assign.

Champion

Hi Gustavo,

Why you don't create a static table for status you need? Will simplify the code and your life.

Regards

Hi Paulo, 
I'm not sure if I understood correctly but the agreement status is a column in the Agreement table.


So I still need to map the values, right?

Thank you for the quick reply :)

Solution

Hi Gustavo,

Having the agreement_status as a foreign key pointing to a static entity will make it easier to refer to a certain status in the code, or to change it's label for example.

As for your initial question, you are missing something basic here. The assign does not perform an actual database operation. To make the assign reflect in the database, you need to add an (CreateOr)Update of the Agreement record after the assign.

Hello Sam,
Oh, I forgot the assign doesn't reflect on the database, thank you so much for helping me and for the quick reply!

Just to confirm, 
After adding the UpateAgreement it asks for the source and I selected "GetAgreements.List.Current" and once I'm already assigning the values it should be good to go, right?
 

So it's, 
For each "GetAgreements.List"

Check GetAgreements.List.Current.Agreement.Status = True/False and GetAgreements.List.Current.Agreement.agreement_status = 0

Assign the values to the new variable

Update the Current Agreement in the data base

Go for the next Agreement

End


Again, 
Thank you so much!

I just made the change and it worked, thank you so much!!

Champion

Something like that instead booleans. Just take advantage from static tables!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.