Save expression value in database

Hello All,

i have an expression named "total" which has the value A.

Also, i have a database named "my_database" and i want to save the expression value(the "A") to the database.

Any suggestion how to do it?

I don't know if I understand what you want, but if you have an entity where you want to record a value, why don't you use one of CRUD's actions, create / CreateOrUpdate / Update?


If you have not understood your question well, can you give more details?

you have understand correct what is my need. but how i will record the value of the label to the entity?

George, do you really mean save the "value of the label" ?

Regards

Yes, you are right.

This post is a little old, but I think it answers and explains what you want. If not, tell me what you want in more detail. As if you had to tell a story.

https://www.outsystems.com/forums/discussion/29522/save-a-value-in-to-db-at-the-same-time/

Thanks for your reply.

unfortunately, i dont understand the article. Any advise?

Hi George,

Firstly you need to have a table to store the total.

Example: You have a Order Table 

and you have another table OrderItem


Now you need to update the total of all orderitems (Price in this example) to Order table.

Now, Order Id already exists in order table as you have added OrderItems based or OrderId. In this case you have to 

   - get the Order record form entity and 

   - assign the total value from your expression 

   - update order.


Hope this simple explanation helps.


Regards,

Saugat

Hello Thanks for your reply.

In my environment i have the below label (named "other2"), which calculate a number.

My request is to save it to the below field which save it's value to the "total_money" field

My request is to advise me , for example how to save the "other2" value to the "Form_Description12" ?

Hello George Mitsiou,


Create an entity with the attribute total_money and any extra attribute if any.

Now once you have the entity ready you can use the entity actions and create a record with the total money value use this entity for form source and on the save action use the entity action.


George Mitsiou wrote:

Hello Thanks for your reply.

In my environment i have the below label (named "other2"), which calculate a number.

My request is to save it to the below field which save it's value to the "total_money" field

My request is to advise me , for example how to save the "other2" value to the "Form_Description12" ?

Hi George,

Why do you have a label for the computed number. It should be an expression. And the variable bound to that expression should be set to your Form_Description12 before you try to save it.

Also if you are forced to use instead of expression, use JavaScript:

document.getElementById('other2').value


If you could share the OML, maybe we can get much clearer picture of what you are trying to achieve.


Regards,

Saugat



Thank you very much for your reply.

You may find attached the .oml file.

Also, the other2 expression is the marked with yellow. This expression calculate successfully the value. The request is to set the other2.value to the Form_Description12.