Hi Community,
How do i clear the values of my local variable, which has data type of entity. I have tried to manually assign "" or NullIdentifier() using Assign.
I ran into a problem for my attribute IsMainOrLeader, as it is a boolean value. Even thou, i still set it to False (i couldn't assign NullIdentifier() to it), i think it is still a value. As such, this record was still being pass into my CRUD actions, and was updated accordingly.
Is there a ListClear equivalent?
Thank you.
Create a local variable say TeamLeaderCopy of the required type and assign this to your variable when you want to reset it. btw not sure this is an optimal solution but it works. But remember that all the variable will have its default values ( and you cannot set null to a boolean and default value of boolean is false).
Hi
You can clear all the values by creating another variable of the same type and assigning it to the current variable or by manually assigning every value.
But as far as i understood you are facing issue with "IsMainOrLeader" variable as it is boolean. if you assign a default value to this attribute it will get reset to the default value (False if default not assigned). but you'll have to assign a value to boolean.
if you don't want a default value. i would suggest you to change the attribute Datatype to text and assign "TRUE/FALSE" text instead while using it but it will increase the efforts.
else you can assign a default value of the attribute that you want in the record.
regards,
mukul nathawat
Hi Jun,
The fastest way to reset values of a variable with multiple attributes is to create a local variable with exactly the same data type and assign the used variable to this empty one.
Be aware that in OutSystems NULL values are equal to "", 0, False, etc., so you have to consider this when passing values to CRUD. If you share what is the logic around your updating and what result you want to achieve, people here will be able to help you with this.
I also think this is the best approach
Hi Jun ,
Can you try creating a structure with the entity as an attribute and a flag to maintain if the data is to be deleted or not . Then instead of using local variable type as entity, you can use this new structure.
Refer to the attached oml to check if your issue can be resolved from this.
Hi @jun mun chan
for this approach you can create a duplicate of the variable on the onready of the screen and then assign that value to a new local variable and then whenever you want to reset values you can simply assign back that variable to your actual variable.
second thing is that you can also use the javascript to set the variable values to empty based on data types.
hope this will help you.