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 / Text to text literal?
Power Apps
Unanswered

Text to text literal?

(0) ShareShare
ReportReport
Posted on by

I'm trying to use a combobox to show a certain column of a certain table based on variables set earlier.

 

Sheet is the name of the columns in a certain table defined as so:

 

Set(sheet, Text(Dropdown1.Selected.Value))

However when trying to use it in this command:

ShowColumns(TableName, sheet)

The error is that there is no text literal. How do i get this command to work, still using these variables?

 

Kind regards,

Colleen

Categories:
I have the same question (0)
  • Rick72 Profile Picture
    385 on at

    Hi @Anonymous,

     

    What happens when you add a static value in ShowColumns? I think using a variable is not allowed in ShowColumns (https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-table-shaping).

     

    As a workaround (depending on the amount of possible values), you could use a switch function based on sheet.

     

    Robot Happy Rick

  • v-xida-msft Profile Picture
    on at

    Hi @Anonymous,

     

    Do you want to show a certain column of a table based on a variable?

     

    I agree with @Rick72's thought almost. The ColumnName(s) argument part of the ShowColumns function is required to fill a string wrapped with double quotes (e.g. "Name").

     

    More details about ShowColumns function, please check the following article:

    ShowColumns function

     

    If you want to show a certain column of a table based on a variable using ShowColumns function, I afraid that there is no way to achieve your needs in PowerApps currently.

     

     

    If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

    https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

     

     

    Best regards,

    Kris

  • Rick72 Profile Picture
    385 on at

    My workaround is something like:

     

    Switch(sheet,
        "One", ShowColumns(TableName, "One"),
        "Two", ShowColumns(TableName, "Two")
    )

     

    That is possible. When there are many options for sheet (or when it is dynamic), the workaround will not be an option.

     

    Robot Happy Rick

  • Community Power Platform Member Profile Picture
    on at

    Thanks both @Rick72 and @v-xida-msft for your help and yes Kris to your question, that is the hope!

     

    @Rick72 your solution looks promising however i don't quite understand what it is doing. The documentation for the switch function has always confused me. At the moment there seems to be a problem:

    The function "Show Columns" has some invalid arguments.
    The specified column "One" does not exist.

    Am i meant to exchange one, two etc for column headers? If so that is not an ideal solution as there are about 50! 

     

    Thanks once again for your help so far,

    Colleen

  • Rick72 Profile Picture
    385 on at

    "One" and "Two" are just examples. It are possible values of the variable sheet, Does this make more sence now?

  • Community Power Platform Member Profile Picture
    on at

    @Rick72 I think so.. Does that mean i need to replace "one" and "two" with every possible value of sheet?

  • Rick72 Profile Picture
    385 on at

    For every possible value, there has be to be a "line" yes. If you have many options, this workaround may as mentioned not be useable. How many options do you have?

     

    Another example:

     

    Switch(sheet,
        "Sheet1", ShowColumns(TableName, "Sheet1"),
        "Sheet2", ShowColumns(TableName, "Sheet2"),

        "Sheet3", ShowColumns(TableName, "Sheet3")
    )

     

    Please note that the last "line" has no comma at the end.

     

    Robot Happy Rick

  • Community Power Platform Member Profile Picture
    on at

    Ah i see - thanks for that. Yes there's a fair few options it could be.. around 40-50. Would you see this as the only solution in this case?

  • Community Power Platform Member Profile Picture
    on at

    I have gone through and adapted your code with my sheet names however have spotted an error - any sheet with a space is not being recognised:image.png

     

     

    Is there a workaround for this/ is this a powerapps bug?

     

    Many thanks,

    Colleen

  • Rick72 Profile Picture
    385 on at

    Using " is good. I guess your column definition is different. What do you see when you go to "File" in the menu and then select "Collections". What is shown for "TableName"?

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard