We should have an option to empty the Object
473
Views
9
Comments
New
Builtin & User functions

Hi Community, 

We may end up creating large objects based on our business requirements and there are instances where we need to empty the object or part of it in our logic, as of now we are explicitly assigning "" values by expanding each and every variable from that object, so it would be great if there's a built in function kind of thing to empty the same object or part of it like in traditional coding.



Regards,

Mahesh

not sure what you mean by 'object', if you mean a multi level structure with many attributes, a trick is to have another empty variable, and use that to asign your actual variable when you want it empty.

Or if you want this even cleaner , make a function exporting the same structure empty, that way in your actual code, there is no need for extra local variables called 'empty structure XXX'

Yes @Dorine Boudry , you're right and that's what i exactly meant, and i understand your suggestion, even in this case devs need to create as many as functions to deal with the number of structures that we create.

yes, agree it would be nice to have a built in function that works for all structures

another alternative, 

with no extra actions, and no local variables, 

but with an extra node in your flow :

Use deserialize of an empty object into your structure, then assign your variable to the result of the deserialize





Merged this idea with 'New Instance / Class' (created on 08 Sep 2024 16:31:22 by Kerollos Adel)

we can set Id = NullIdentifier() , but when work with object we can not reset all object valus like 


Emp { Name , Id }

there are no option to Emp = new Emp() 

Actually, I think you already can, you just need a second variable:


yes and also you can new action and just pass the object from it , but i take here to add as function / action what ever , there are many ways to work around way not be clear :-) 

Please search ideas first to avoid double posting of ideas, that need to be merged.