Hi.
One thing that I still dont fully understand are the structures.
Imagine I have the a situation that I have a block and that block is being used on a screen.
Inside that block I have an imput name with a save button.
But the data i am getting to appear inside the input name comes from a structure.
But now I want to change that name and click SAVE .
With agregates and CRUD i managed to do it but with structures I cant find a way.
Thank you in advance.
Kind regards.
Pedro B
The structure is just to manage data and add data that is not on an entity and you want to calculate in some time to show on the screen calculated values, etc. So, you can have a structure that is the same as the structure of an entity but you can put more fields on a structure to show other things on your screen.
To save with your structure. If you want to save the values from a structure you can use them as a source on an entity action and you will need to map the values on the entity action source because it expects values that the entity's fields have.
For example, you can use structures to keep values from an API, you can use a structure to get a certain number of values in case you don't want to get everything(all the fields), you can use a structure to add calculated fields that on the entity you don't need, but on the screen you need, etc.
Kind Regards,
Márcio
Hi Pedro,
Yes we can change the value in structure as well.
Please find the updated OML. Check Screen2 and Block2.
Let me know the feedback!
Thanks
Vinod
For persistent you need to use either entity or client variable.
Structure holds values in memory and its scope is limited.
On Screen2 I am initializing the structure name, so that's why old value is coming.
Hi Márcio, thank you for your answer.
I dont know if I understood 100% of what you said.
My scenario is:
I have an input labeled as Name with a save button.
When the user open the page the input will appear already with a name. Inside the input the name shown is being fetched inside a structure.
But the user can just click inside the input and erase that name, type another one and click save.
When click save, i want that new name inside the input to be stored inside the structure to replace the old one.
I can do that using an agregate but in my situation I need to do it with structe.
Hey,
On save click you can store value to entity using structure which you bind to input.Once successfully saved then retrieve data from entity and update into structure so whatever new value get store will replicate on UI.
Hope you will understand.
Yogesh
I have created a sample as your requirements. Please find the attached OML.
Hi, thank you everyone one.
Vinod Patidar, Thank you for your time doing this example.
I actually do not have an entity.
I dont want to save from a structure to an entity.
But change the value inside the structure.
So if I have a structure with an atribute name, and the name stored there is Robert. But now I want to change that name inside that atribute from the structure to Pedro.
Hi Vinod Patidar ,
thank again for your time.
I tested your OML, but what happens is that when I change the name and click Update it works, but if I reload the page the name comes back to the old one and doesnt persist.
regards