web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Setting Field Labels d...
Power Apps
Unanswered

Setting Field Labels dynamically in a Powerapps Form

(0) ShareShare
ReportReport
Posted on by 6

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)

Categories:
I have the same question (0)
  • rubin_boer Profile Picture
    4,841 Super User 2024 Season 1 on at

    hi @justinridgebd 

     

    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

    columns as labels.gif

    Hope it helps,

    R

     

  • CU13081438-0 Profile Picture
    14 on at

    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

    justinridgesa_1-1645945422068.png

     

    Submissions Form

    justinridgesa_0-1645945399995.png

     

    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!

  • Ethan_009 Profile Picture
    4,838 Moderator on at

    Hi @justinridgesa ,

     

    Are you trying to say that if you select 'Check1' as true then it label should change from 'Check1' to 'Sandals' ?

  • CU13081438-0 Profile Picture
    14 on at

    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

  • Ethan_009 Profile Picture
    4,838 Moderator on at

    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.

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard