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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Identify column name a...
Power Apps
Unanswered

Identify column name and patch

(0) ShareShare
ReportReport
Posted on by 42

Hi I have 30 columns named from 1 to 30 ... I have an input drop-down from 1 to 30 .. if the user selects number 2 ... And gives a value in textinput ... This value should get patched in that column '2'.

If user selects 30 and enters textinput.. this text input value should get patched under column '30'. 

 

Simply user should select the column as well as enter the data into that particular column..

I have tried many ways but could not fix it.

Can someone help me with this.

Thanks in advance.

Categories:
I have the same question (0)
  • KvB1 Profile Picture
    1,596 on at

    Unfortunately, I don't think its possible to have a dynamic value for the column you want to patch in a formula.

     

    You can get around this by integrating all 30 columns in your Patch formula, but use an If( statement connected to your dropdown value to determine whether the column gets updated or not

  • Shahin1 Profile Picture
    42 on at

    Can you please give the formula which might be helpful for me

  • zmorek Profile Picture
    3,272 on at

    Assuming you will not add more columns in the future, you could use a (big ugly) switch case:

    Switch(
    Dropdown1.Selected.Value,
    1, Patch(DataSource, Record, {Column1: TextInput1.Text}),
    2, Patch(DataSource, Record, {Column2: TextInput1.Text}),
    etc.
    )

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Shahin1 

    Sure, you can do this fairly easily from the dropdown items.

     

    You have not mentioned how a particular record is chosen for your scenario, so I will make an assumption on that and you can change as needed.

     

    For your Dropdown, have an Items property of:

    With(LookUp(yourDatasource, yourRecordLookupCriteria),
     Table(
     {Column: "1", Data: col1, Update: {col1: TextInputConrol.Text}},
     {Column: "2", Data: col2, Update: {col2: TextInputConrol.Text}},
     {Column: "3", Data: col3, Update: {col3: TextInputConrol.Text}},
     ...etc...
     {Column: "30", Data: col30, Update: {col30: TextInputConrol.Text}}
     )
    )

    Replace the LookUp part with a record variable if you already have one.  Also change the column names as needed.

     

    Then for your TextInput control, set the Default property to:  yourDropdown.Selected.Data

     

    And, for your Update/Submit button, use the following formula on the OnSelect action:

    UpdateIf(
     yourDataSource, 
     ID=yourrecordID,
     yourDropDown.Selected.Update
    ) 

    This should give you what you are looking for.

     

    One word to note on this, the Dropdown and lose its selection as PowerApps re-evaluates the Items formula on it when you update, so to avoid that, add the following formula to the OnChange action of the Dropdown:  UpdateContext({lclSel: Self.Selected.Column})  Then set the Default property of the dropdown to: lclSel

     

    I hope this is helpful for you.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#2
11manish Profile Picture

11manish 205 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard