Store local variable in entity...
Application Type
Mobile

I created a SCREEN, dragging the USERS entity and managed to save the user ID and your respective NAME in local variables.

I created another SCREEN, dragging the TASKS entity and managed to show the local variables in the respective INPUT and when I click on the SAVE button, the variable values are not recorded, the ID comes with the value 0 and the USERNAME empty. How can I get these values recorded in the TASKS entity?

Solution

Done

You were forgetting to assign your data.

Another thing is, you can go and see @Benjith Sam and study a little because is a bit more complex than the way you are doing and it's a great opportunity to learn. But don't forget, you must learn by trying and see the differences from a complex and not complex and by your mistakes


Happy low code to you!

Best regards,

Márcio

BellaNapoli.oml

mvp_badge
MVP
Solution

Hi Nova,

In addition to the previous comments & correction, the suggestion which I want to mention based on my understanding for the described case is...

  • Use Case: When the TaskDetail Screen input parameter is TarefaId = Null, then you want to have the Task Form Task UserId input and the Task UserName input value as the current logged-in UserId and the UserName values respectively. 
  • If the point 1 is what you are implementing, then I would suggest you to define the same in the GetTarefaById aggregate OnAfterFetch action flow, instead of in Screen OnInitialize handler flow. 
  • Use the GetTarefaById aggregate's Source Entity attribute (i.e. TarefaUsuario, TarefaNomeUsuario) as the Form input varialbles, by doing this, you can reduce defining two additional local variables.
  • Set the GetTarefaById Aggregate Max.Records property value as 1
  • And also I would suggest, If possible, change the TarefaUsuario attribute data type to UserId type instead of integer data type

Refer to the attached .oml file


I hope this helps you!


Kind regards,

Benjith Sam

BellaNapoli.oml

I have tested your changes and appreciated your comments.

Your changes worked perfectly when writing a new record. Thank you for your help...

You need to mark the solution or solutions that helped you @Nova Bella Napoli, not your answer :D Not the first time I see this, don't worry :) This is just to close the thread and make a final good closure.

Best regards and again, happy low coding :)

mvp_badge
MVP

Hello there Nova,

Following the answers provided in this thread, I took the liberty to mark Benjith's and Marcio's answers as solutions instead of your own reply.

Marking the right answer(s) as a solution will be helpful for other forum members in the future if they run into a similar issue.

Also it is a way to give credit to the person/people that helped you :) 


Kind regards,

Rui Barradas

Sorry, I'm new to the forum and I only marked one answer as resolved and I should have marked both.

Hey there!

First, can you share the OML?

Second, in the tasks entity do you have any reference to the user, i.e there is an userId on the entity TASKS to be associated with a task or various tasks?


You need to associate to the form a variable or aggregate of type tasks, and when you are adding the tasks to a user you need to give to the aggregate the id of the user, and the tasks attribute you want to include. then when you are saving you need to use the action CreateOrUpdate and put that aggregate/variable of type TASKS to create a new TASK

Best regards,

Márcio

Márcio, sorry for the errors in English, because I'm using a translator. I'm brazilian. I'm new to OUTSYSTEMS and I don't know what OML is.

Yes, I have the ID and USERNAME reference inentity TASKS.

You said associate a variable to the form and if it is in the first form or screen USERS, I have already associated it. If it's in the second form, I've also associated it and even managed to show it in the input. The problem is in recording, it does not record the values that appear in the INPUT.

No problem, you don't need to be sorry! :D

These are the steps! :)

The OML is the module


So what I saw, is that you weren't saving or assigning the name and the id of the user to the entity variable!

You need to save too to the entity

Can you try now?



---One question, and is a doubt,

what do you want to add here? 

Best Regards,

M´árcio


Use the OML that I shared to you, and give it a try now, and let me know if it worked

BellaNapoliMarcioVersion.oml

Marcio, is now saving the username correctly, but the ID is not saving. The id should be the variable VarTarUsu...

Your question

1 - LOGIN USER ID

2 - LOGIN USER NAME

3 - TASK DESCRIPTION

okok and the variable VarTarUsu you want to save in which attribute in the entity Tarefas?

TarefaUsuario

You even removed it from TAREFADETAIL

Solution

Done

You were forgetting to assign your data.

Another thing is, you can go and see @Benjith Sam and study a little because is a bit more complex than the way you are doing and it's a great opportunity to learn. But don't forget, you must learn by trying and see the differences from a complex and not complex and by your mistakes


Happy low code to you!

Best regards,

Márcio

BellaNapoli.oml

mvp_badge
MVP
Solution

Hi Nova,

In addition to the previous comments & correction, the suggestion which I want to mention based on my understanding for the described case is...

  • Use Case: When the TaskDetail Screen input parameter is TarefaId = Null, then you want to have the Task Form Task UserId input and the Task UserName input value as the current logged-in UserId and the UserName values respectively. 
  • If the point 1 is what you are implementing, then I would suggest you to define the same in the GetTarefaById aggregate OnAfterFetch action flow, instead of in Screen OnInitialize handler flow. 
  • Use the GetTarefaById aggregate's Source Entity attribute (i.e. TarefaUsuario, TarefaNomeUsuario) as the Form input varialbles, by doing this, you can reduce defining two additional local variables.
  • Set the GetTarefaById Aggregate Max.Records property value as 1
  • And also I would suggest, If possible, change the TarefaUsuario attribute data type to UserId type instead of integer data type

Refer to the attached .oml file


I hope this helps you!


Kind regards,

Benjith Sam

BellaNapoli.oml

I have tested your changes and appreciated your comments.

Your changes worked perfectly when writing a new record. Thank you for your help...

You need to mark the solution or solutions that helped you @Nova Bella Napoli, not your answer :D Not the first time I see this, don't worry :) This is just to close the thread and make a final good closure.

Best regards and again, happy low coding :)

mvp_badge
MVP

Hello there Nova,

Following the answers provided in this thread, I took the liberty to mark Benjith's and Marcio's answers as solutions instead of your own reply.

Marking the right answer(s) as a solution will be helpful for other forum members in the future if they run into a similar issue.

Also it is a way to give credit to the person/people that helped you :) 


Kind regards,

Rui Barradas

Sorry, I'm new to the forum and I only marked one answer as resolved and I should have marked both.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.