So, on to my next issue. I am creating an entity that has several fields, and this entity will be a database for an inspection finding tracking system. There are many fields, but I'm currently working on 3 text fields. Field 1 is going to be a field that is autogenerated with information that is joined (concatenated) from Fields 2 and 3, which are both Text fields. These fields will be inserted into a Power App Canvas app and published in Teams for my organization to have inspectors go in and enter their findings data.
Field 1 - "Recommendation ID" (This is a text field and is the Primary Name Field)
Field 2 - "Report Name" (This is a Text field)
Field 3 - "Recommendation Number" (This is a Text field)
Field 1 needs to be automatically generated by Field 2 + Field 3.
Example:.
Field 2 Entry = "2020-AB-295-01"
Field 3 Entry = "01"
Desired Field 1 Auto Generated entry = "2020-AB-295-01"
Is there a way to create an entity field that automatically generates Field 1 in CDS as the user enters data? Or is there another way I'm supposed to do this? I want to avoid having the user fill in Field 1 manually, as it is redundant work and could result in entry errors.
Thanks,
Randy
Solved! Go to Solution.
Hi @RDJHUD
According to your description, could you tell me what kind of demand do you want?
Situation 1: you want to automatically fill in field 1 when you use canvas to edit data?
Situation 2: Do you want to automatically fill in field 1 by field 2 and field 3 ?(Automatically execute in the background not through the canvas app)
Situation 1: If you use canvas to edit data
1) Firstly, you can use the UpdateIf() function to modify the existing records to what you need.
2) Secondly, use Patch() function to submit new record when users enter information.
I've made a test for your reference:
I assume:
Users submit data by using two textinput controls and one button control.
1\ Set App’s onstart property to:
UpdateIf(Test11S,true,{'Recommendation ID':'Report Name'&"-"&'Recommendation Number'}) //Test11S is my test entity
2\ Add a textinput control ‘TextInput1’
3\ Add a textinput control ‘TextInput2‘
4\ Add a button control to screen and set its onselect property to:
Patch(Test11S,
Defaults(Test11S),
{
'Report Name':TextInput1.Text,
'Recommendation Number':TextInput2.Text,
'Recommendation ID':TextInput1.Text&"-"&TextInput2.Text});
Reset(TextInput1);
Reset(TextInput2)
5\ The result is as follows:
Situation 2: Use calculated fields
If you do not use canvas, primary name field cannot be automatically filled.
I suggest you add a Text field and set its calculation parameter:
Best Regards,
Bof
Hi @RDJHUD,
Just like in your other post, you can achieve that with calculated fields. The field will be auto-calculated real-time on retrieval of the record.
Did you give that a try?
Cheers
Hi @RDJHUD
According to your description, could you tell me what kind of demand do you want?
Situation 1: you want to automatically fill in field 1 when you use canvas to edit data?
Situation 2: Do you want to automatically fill in field 1 by field 2 and field 3 ?(Automatically execute in the background not through the canvas app)
Situation 1: If you use canvas to edit data
1) Firstly, you can use the UpdateIf() function to modify the existing records to what you need.
2) Secondly, use Patch() function to submit new record when users enter information.
I've made a test for your reference:
I assume:
Users submit data by using two textinput controls and one button control.
1\ Set App’s onstart property to:
UpdateIf(Test11S,true,{'Recommendation ID':'Report Name'&"-"&'Recommendation Number'}) //Test11S is my test entity
2\ Add a textinput control ‘TextInput1’
3\ Add a textinput control ‘TextInput2‘
4\ Add a button control to screen and set its onselect property to:
Patch(Test11S,
Defaults(Test11S),
{
'Report Name':TextInput1.Text,
'Recommendation Number':TextInput2.Text,
'Recommendation ID':TextInput1.Text&"-"&TextInput2.Text});
Reset(TextInput1);
Reset(TextInput2)
5\ The result is as follows:
Situation 2: Use calculated fields
If you do not use canvas, primary name field cannot be automatically filled.
I suggest you add a Text field and set its calculation parameter:
Best Regards,
Bof
Power Apps User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.
Did you miss the call?? Check out the Power Apps Community Call here!
User | Count |
---|---|
36 | |
17 | |
5 | |
4 | |
4 |
User | Count |
---|---|
32 | |
27 | |
11 | |
9 | |
7 |