Hi there
I have a Dataverse table called "Clients" with the following fields.
Client Name - Text
ChecklistItem 1 - Text
ChecklistItem 2 - Text
ChecklistItem 3 - Text
The, I have another Dataverse table called "Items" with the following fields
Client Name (Lookup to Clients folder)
Check 1 - Yes/No
Check 2 - Yes/No
Check 3 - Yes/No
I wanting to know if it's possible to set the Label of Check1, Check2 and Check3 to be the value of ChecklistItem 1, 2, 3 in the Clients table (corresponding to the client lookup chosen for the record).
Obviously, I can't change the name of the field names as this would affect the whole table and not just the selected record.
If there is a solution via Javascript, please could you give me step by step instructions, (as my Javascript knowledge isn't that great)
This will help or give direction;
i assume 3 columns in both tables and should it be more or dynamic you can use ForAll
add a dropdown to your dorm where the user can select the client
now consider the following
DataSource(_clients) two entries with the client name some name 1 and some name 2:
ClearCollect(
_clients,
{
ClientName: "some name 1",
'ChecklistItem 1': "Some item 1",
'ChecklistItem 2': "Some item 2",
'ChecklistItem 3': "Some item 3"
},
{
ClientName: "some name 2",
'ChecklistItem 1': "Another item 1",
'ChecklistItem 2': "Another item 2",
'ChecklistItem 3': "Another item 3"
}
)
the dropdown has this DataSource with the Primary text the ClientName
OnChange of the dropdown add the following formula
ClearCollect(
_items,
AddColumns(
Filter(
_clients,
ClientName = Self.Selected.ClientName
),
"Check Items",
'ChecklistItem 1' & "," & 'ChecklistItem 2' & "," & 'ChecklistItem 3'
)
)
add a gallery and set the Items = Split(First(_items).'Check Items',",")
add a label and a toggle swtich to the gallery, set he label's Text = ThisItem.Result
The result
Hope it helps,
R
Hi Rubin.
Thanks for your response.
I should have made it clear that I am actually using a Model-driven app and not a Canvas app.
As you can see below, I have a Client Form (and Dataverse Table) with my Client Names and the 5 checklist items for each client (Text fields).
In the Submissions Form I have the Client Name (lookup to the Clients table).
I also have 5 fields for the 5 checklist items (These are Yes/No fields)
As you'll see from the pic below, in the Submissions form there are the checklists.
What I want to be able to do is set the label of each checklist to be equal to the Value of the corresponding checklist item in the Clients table/form.
Client Form
Submissions Form
My gut says this isn't achievable through this method, but if you have any ideas on how to achieve the same kind of thing, please let me know
Thank you!
Hi @justinridgesa ,
Are you trying to say that if you select 'Check1' as true then it label should change from 'Check1' to 'Sandals' ?
Hi Ethan (Replying from a different account)
No, the label should change to 'Sandals' regardless of whether is set to True/False.
So, I basically am wanting to pull the checklist data (From clients) into the 'Submissions' entity - to the corresponding fields.
The challenge is that these values will change from Submission to Submission (because each submission references a different client from 'Clients'.
Hope that makes sense
Hi @justinridgesa ,
This is quite challenging, I feel you should have some kind of sub-grid that holds values for such Checklist items as this will save Name of Item and Toggle Value in backend.
If you want just frontend for temporary basis (since Labels are not stored in database), you can use JS to achieve this.
// To change the Label of Control/Field
//This is basic label changing code.
formContext.getControl("new_check1").setLabel("Test Renamed");
For getting Clients checklist items,
You will need to use 'retreiveRecord' and pass fields name that you want.
Then loop the result with you list of Labels of CheckList items from 'Submission' entity and set each label accordingly.
Note: I don't recommend this since label won't be stored and can be altered if queue is disturbed. This can only be effective if CheckList Items on both entities are constant (i.e. won't change) and require temporary knowledge of what each checklist stands for.
User | Count |
---|---|
258 | |
108 | |
95 | |
58 | |
40 |