Assigning a value to different variables based on different conditions

Assigning a value to different variables based on different conditions

  

Hi, Can anybody help me with this:

So I have an entity with attributes 1.1, 1.2 ...... all the way until 9.8, 9.9. What I want to do is when a button is clicked, I want 1.1 to be assigned a value if section 1 is selected and 1.1 is empty and so on and so forth (if section 2 is selected and 2.1 is filled but 2.2 is empty, I want 2.2 to be assigned the value)

Does anybody have an example of how to do this on a mobile application? I have been stuck on this for very long. Thanks.

Hi Louie,


Can you provide a print screen of your entity?


Best Regards,

Diogo Romero

Romero wrote:

Hi Louie,


Can you provide a print screen of your entity?


Best Regards,

Diogo Romero

Sure.


Louie Ng wrote:

Romero wrote:

Hi Louie,


Can you provide a print screen of your entity?


Best Regards,

Diogo Romero

Sure.



So basically what i would suggest is to create a variable of  "Guide Record" (Your entity). And i would make a loop, to fill this variable according to your needs and rules and then inserting into your table.


Does this help ?


Best Regards,

Diogo Romero


Romero wrote:

Louie Ng wrote:

Romero wrote:

Hi Louie,


Can you provide a print screen of your entity?


Best Regards,

Diogo Romero

Sure.



So basically what i would suggest is to create a variable of  "Guide Record" (Your entity). And i would make a loop, to fill this variable according to your needs and rules and then inserting into your table.


Does this help ?


Best Regards,

Diogo Romero


Hi Diogo Romero,

I have tried using entity variables before but I do not understand how they work. Would it be okay if you provided me with an example? Thanks.

Regards,

Louie


Hi again,

I did a quick example with a Guide Entity and a var from "Guide Type" and how to assign a value to it. Now all you have to do is create your logic in order to assign the values and at the end just call the CreateGuide(this function name can change according to your Entity Name)  and pass the list as parameter to it.


Hope this helps.


Best Regards,

Diogo Romero

Romero wrote:

Hi again,

I did a quick example with a Guide Entity and a var from "Guide Type" and how to assign a value to it. Now all you have to do is create your logic in order to assign the values and at the end just call the CreateGuide(this function name can change according to your Entity Name)  and pass the list as parameter to it.


Hope this helps.


Best Regards,

Diogo Romero

Hi Diogo Romero,

It is the logic part which I do not understand how to do. Could you help me with that by providing an example? Thanks.

Regards,

Louie


Hi Louie,

I'm trying to understand what you want to do but I didn't. Can you provide a screenshot of your screen or even a module?


Regards,

António Pereira

Louie,

I'll try to be as polite as I can, no meant to be disrespectful in any way.

If you don't know how to use a variable of type entity, you don't know how to use OutSystems. You should focus yourself on learning the basics of the platform, through the online training, the documentation and doing small tests.

Cheers

António Pereira wrote:

Hi Louie,

I'm trying to understand what you want to do but I didn't. Can you provide a screenshot of your screen or even a module?


Regards,

António Pereira

Hi Antonio Periera,

Sure, I have attached a sample oml file. As can be seen from the oml file, the logic is very complex. What I am trying to do is to reduce the logic so that I do not have to create the same logic for each of the switch conditions.

Regards,
Louie


Hi Louie,

Do you mean:

- First Input to section 1


- Second input to section 1:


- and so on..

The main logic is like yours and it is hard to simplify, unless we use dynamic sql,

regards, indra


Indra Budiantho wrote:

Hi Louie,

Do you mean:

- First Input to section 1


- Second input to section 1:


- and so on..

The main logic is like yours and it is hard to simplify, unless we use dynamic sql,

regards, indra


Hi Indra,

Yes, that is exactly what I mean. I have been thinking non-stop on how to simplify the logic. So does that mean I have to create 9*9=81 "Assign"s?

Regards,

Louie 


Yes, you have to. I have attached the .oml for mobile app only for 3 x 3.

regards,

Indra