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 / logic issue that might...
Power Apps
Answered

logic issue that might be solved in a simpler way

(0) ShareShare
ReportReport
Posted on by 648

Hello, I have a logic issue that might be solved in a simpler way.

Currently, I have a form with various response options through radio buttons. The field in the SharePoint list is a text field.

I retrieve the table containing my list choices:

ClearCollect(Positivt;
{Indexnr:"1";Urval:"Alltid"};
{Indexnr:"2";Urval:"Ofta"};
{Indexnr:"3";Urval:"Ibland"};
{Indexnr:"4";Urval:"Sällan"};
{Indexnr:"5";Urval:"Aldrig"};
{Indexnr:"6";Urval:"Vet inte"}
)

The text box is named = txtFragaVal.Text
The code is LookUp(gyelevenkatfraga; Indexordning = Parent.DisplayName).Radioval

This code ensures that the correct radio button selection is displayed in the question.

If(txtFragaVal.Text = "PositivStamma.Urval"; PositivStamma.Urval;
If(txtFragaVal.Text = "Positivt.Urval"; Positivt.Urval;
If(txtFragaVal.Text = "Negativt.Urval"; Negativt.Urval;
If(txtFragaVal.Text = "PositivtBemot.Urval"; PositivtBemot.Urval;
If(txtFragaVal.Text = "PositivtHjalp.Urval"; PositivtHjalp.Urval;
If(txtFragaVal.Text = "PositivHallamed.Urval"; PositivHallamed.Urval;
If(txtFragaVal.Text = "PostivtPaverka.Urval"; PostivtPaverka.Urval;
If(txtFragaVal.Text = "PositivStamma.Urval"; PositivStamma.Urval
)))))))))

Can I combine and directly integrate this into my radio button choices in PowerApps, instead of using an IF statement for each question and an additional text box?

dalacarelia_196_0-1702983297328.png

 

Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,833 Super User 2026 Season 2 on at

    Hi @dalacarelia_196 ,

     

    I'm convinced there's a simpler way to do what you want to do, just it's not clear what you want to do. Therefore it's hard to give a response to your question.

     

    Can you please clarify what you want to achieve and for any formulas given, indicate for which control and property they are used?

  • dalacarelia_196 Profile Picture
    648 on at

    Hello and thank you for willing to help me.

    I have built a database where all response options are stored, along with all the questions.

    In my form, I want to replace the texts in the radio buttons with those stored in my database.

    The question texts themselves work, but the radio buttons won't function without me creating a boolean question.

    My gut feeling is that the text of the radio buttons is a table. In this case, a radio button cannot call the field in the Items property (Dropdown1.SelectedText.Value) and display values coming from my collection with the same name "Negativt.Urval." I only get that value in a radio button, not the actual choices in the database.

    My workaround is to use an IF statement for each answer option:

    If(txtFragaVal.Text ="Negativt.Urval";Negativt.Urval ;

    This works to display the correct text inside the radio buttons.

  • Verified answer
    WiZey Profile Picture
    3,023 Moderator on at

    Hello @dalacarelia_196 ,

     

    Is there really a need for the textbox "txtFragaVal"? You can directly call it in the "Items" of your radiobuttons.

     

    With({_text:LookUp(gyelevenkatfraga; Indexordning = Parent.DisplayName).Radioval};
    If(_text = "PositivStamma.Urval"; PositivStamma.Urval;
    If(_text = "Positivt.Urval"; Positivt.Urval;
    If(_text = "Negativt.Urval"; Negativt.Urval;
    If(_text = "PositivtBemot.Urval"; PositivtBemot.Urval;
    If(_text = "PositivtHjalp.Urval"; PositivtHjalp.Urval;
    If(_text = "PositivHallamed.Urval"; PositivHallamed.Urval;
    If(_text = "PostivtPaverka.Urval"; PostivtPaverka.Urval;
    If(_text = "PositivStamma.Urval"; PositivStamma.Urval
    ))))))))))

     

    Also, you can use "Switch()" instead of cascading "If()" to make it easier to read.

     

    With({_text:LookUp(gyelevenkatfraga; Indexordning = Parent.DisplayName).Radioval};
    Switch(_text;
    "PositivStamma.Urval"; PositivStamma.Urval;
    "Positivt.Urval"; Positivt.Urval;
    "Negativt.Urval"; Negativt.Urval;
    "PositivtBemot.Urval"; PositivtBemot.Urval;
    "PositivtHjalp.Urval"; PositivtHjalp.Urval;
    "PositivHallamed.Urval"; PositivHallamed.Urval;
    "PostivtPaverka.Urval"; PostivtPaverka.Urval;
    "PositivStamma.Urval"; PositivStamma.Urval
    ))

     

    Finally, you said you store your radio values in a database. Is it the collection made by the constant table with "ClearCollect()"? In that case, you can probably build one single collection to store all your values like this:

     

    ClearCollect(cltRadioButtons:
     {
     Radioval:"Positivt.Urval";
     RadioValues:
     [{Indexnr:"1";Urval:"Alltid"};
     {Indexnr:"2";Urval:"Ofta"};
     {Indexnr:"3";Urval:"Ibland"};
     {Indexnr:"4";Urval:"Sällan"};
     {Indexnr:"5";Urval:"Aldrig"};
     {Indexnr:"6";Urval:"Vet inte"}]
     };
     ...
    )
    
    Then retrieve the radio texts with a single "Filter()" instead of the "Switch()" :
    
    With({_text:LookUp(gyelevenkatfraga; Indexordning = Parent.DisplayName).Radioval};
     Filter(cltRadioButtons;Radioval = _text).Urval
    )

     

    To make it more flexible, you could even create a SharePoint list or a dataverse table to store those values like this:

     

    Radioval Indexnr Urval
    Positivt.Urval 1 Alltid
    Positivt.Urval 2 Ofta
    ... ... ...

     

    I hope my suggestions were clear and helpful.

  • dalacarelia_196 Profile Picture
    648 on at

    Ahhh now i have somethong to digg in to , Thanks 4 the help . 

  • dalacarelia_196 Profile Picture
    648 on at

    @WiZey  

    Sorry but iam lost again  , after i created a new collection 

    ClearCollect(cltRadioButtons;
    {Radioval:"Positivt.Urval";
    RadioValues:[
    {Indexnr:1; Urval:"Alltid"};
    {Indexnr:2; Urval:"Ofta"};
    {Indexnr:3; Urval:"Ibland"};
    {Indexnr:4; Urval:"Sällan"};
    {Indexnr:5; Urval:"Aldrig"};
    {Indexnr:6; Urval:"Vet inte"}
    ]
    };
    {Radioval:"Negativt.Urval";
    RadioValues:[
    {Indexnr:1; Urval:"Aldrig"};
    {Indexnr:2; Urval:"Sällan"};
    {Indexnr:3; Urval:"Ibland"};
    {Indexnr:4; Urval:"Ofta"};
    {Indexnr:5; Urval:"Alltid"};
    {Indexnr:6; Urval:"Vet inte"}
    ]
    };
    {Radioval:"PositivtBemot.Urval";
    RadioValues:[
    {Indexnr:1; Urval:"Mycket bra"};
    {Indexnr:2; Urval:"Ganska bra"};
    {Indexnr:3; Urval:"Ganska dåligt"};
    {Indexnr:4; Urval:"Mycket dåligt"};
    {Indexnr:5; Urval:"Vet inte"}
    ]
    };
    {Radioval:"PositivtHjalp.Urval";
    RadioValues:[
    {Indexnr:1; Urval:"Mycket lätt"};
    {Indexnr:2; Urval:"Ganska lätt"};
    {Indexnr:3; Urval:"Ganska svårt"};
    {Indexnr:4; Urval:"Mycket svårt"};
    {Indexnr:5; Urval:"Vet inte"}
    ]
    };
    {Radioval:"PositivHallamed.Urval";
    RadioValues:[
    {Indexnr:1; Urval:"Helt och hållet"};
    {Indexnr:2; Urval:"Till stor del"};
    {Indexnr:3; Urval:"Till viss del"};
    {Indexnr:4; Urval:"Inte alls"};
    {Indexnr:5; Urval:"Vet inte"}
    ]
    };
    {Radioval:"PositivStamma.Urval";
    RadioValues:[
    {Indexnr:1; Urval:"Stämer helt och hållet"};
    {Indexnr:2; Urval:"Stämer ganska bra"};
    {Indexnr:3; Urval:"Stämer ganska dåligt"};
    {Indexnr:4; Urval:"Stämer inte alls"};
    {Indexnr:5; Urval:"Vet inte"}
    ]
    };
    {Radioval:"PostivtPaverka.Urval";
    RadioValues:[
    {Indexnr:1; Urval:"Väldigt mycket"};
    {Indexnr:2; Urval:"Ganska mycket"};
    {Indexnr:3; Urval:"Ganska lite"};
    {Indexnr:4; Urval:"Väldigt lite/ Inte alls"};
    {Indexnr:5; Urval:"Vet inte"}
    ]
    };
    {Radioval:"KonFraga.Urval";
    RadioValues:[
    {Indexnr:1; Urval:"Kvinna"};
    {Indexnr:2; Urval:"Man"};
    {Indexnr:3; Urval:"Har annan könsidentitet"};
    {Indexnr:4; Urval:"Vill inte ange"}
    ]
    }
    )

    The collection is working 

    dalacarelia_196_2-1703749569592.png

     

    dalacarelia_196_1-1703749549333.png

    Filter(cltRadioButtons;Dropdown4.SelectedText.Radioval)

    dalacarelia_196_3-1703749626490.png
    When i am do the filtering in the radiocontrol

    dalacarelia_196_4-1703749728683.png

    The control is complaing about table 

    dalacarelia_196_5-1703749773449.png

    So how can i extract the table values in the radiocontrol 
    i have trying using the textbox with same result . 


    any idea how to solve this 

     

  • Verified answer
    dalacarelia_196 Profile Picture
    648 on at

    Ahh i fond out how to solve it 

    LookUp(cltRadioButtons; Radioval = Dropdown4.SelectedText.Value).RadioValues
    It was the filter  🙂
     

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