Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

compounded string returning "false"

(0) ShareShare
ReportReport
Posted on by 81

Dear PowerApps Community,

I'm using choice boxes to select parts of a string, these come together into a field "location", now I ton of possible locations and the switch function only supports 26/27 items so I figured something like this would have done the trick:

At the moment I'm using multiple switch functions evaluating the same variable in an OR setup.
This returns "false" instead of the string I hoped to get out of it. Any idea how to fix this, or even better, how to improve this?

Patch(
 Wisselstukken;
 {'Id (ID)': galStockList.Selected.'Id (ID)'};
 {
 Place: (Switch(
 cboLocationSite.Selected.Value;
 "BIOPOWER";
 "EBO";
 "GREENPOWER";
 "EGO"
 ) & "/" & Switch(
 cboLocationMainRoom.Selected.Value;
 "ENGINE EBO";
 "E";
 "ENGINE EGO";
 "E";
 "VOLTAGE DISTRIBUTION EGO";
 "VD";
 "VOLTAGE DISTRIBUTION EBO";
 "VD";
 "TECHNICAL";
 "T";
 "LABO";
 "LB";
 "COMMON";
 "C";
 "IT - SERVER ROOM";
 "IT";
 "OFFICES";
 "O";
 "STEAM TURBINE";
 "ST";
 "STORAGE";
 "S"
 ) & "/" & Switch(
 cboLocationSubRoom.Selected.Value;
 "ENGINE ROOM STORAGE";
 "ES";
 "ENGINE CONTROL ROOM";
 "CR";
 "HALLWAY AIR INLET";
 "HAI";
 "TECHNICAL STORAGE ROOM";
 "SR";
 "REVERSE OSMOSIS ROOM";
 "RO";
 "PUMPHOUSE";
 "PH";
 "COMPRESSORS";
 "COMP";
 "ABB MEASUREMENT";
 "ABB";
 "EMERGENCY GENERATOR";
 "EGEN";
 "LIVING QUARTERS";
 "LQ"
 ) || Switch(
 cboLocationSubRoom.Selected.Value;
 "SANITARY";
 "SAN";
 "ENTRY HALLWAY";
 "EH";
 "WAREHOUSE";
 "WH";
 "ELEVATOR1";
 "EV1";
 "ELEVATOR2";
 "EV2";
 "STEAM TURBINE STORAGE ROOM";
 "SR";
 "HV DISTRIBUTION";
 "HV";
 "LV DISTRIBUTION";
 "LV";
 "AUXILIARY TRAFO";
 "AUXT";
 "EBO ENGINES ROOM";
 "ER"
 ) || Switch(
 cboLocationSubRoom.Selected.Value;
 "EBO ENGINE ROOM STORAGE";
 "ES";
 "EBO HALLWAY ENGINES TANKPARK";
 "HET";
 "EBO HALLWAY ENGINES OFFICES";
 "HEO";
 "EBO ENGINES CONTROL ROOM";
 "CR";
 "EBO ENGINES FILTER ROOM";
 "FR";
 "EBO HALLWAY ENGINES 2ND FLOOR";
 "HE2F";
 "EBO ENGINES EXHAUST LINE";
 "EL7";
 "MAINTENANCE STORAGE";
 "MS";
 "WELDING ROOM";
 "WR";
 "LABO STORAGE SMALL";
 "LSS"
 ) || Switch(
 cboLocationSubRoom.Selected.Value;
 "LABO STORAGE LARGE";
 "LSL";
 "SANITARY MEN";
 "SM";
 "SANITARY LADIES";
 "SL";
 "MESS ROOM OPERATORS";
 "MRO";
 "DELIVERY ROOM";
 "DR";
 "DELIVERY ROOM HALLWAY";
 "DRH";
 "BOILER ROOM TANKPARK";
 "BRT";
 "BOILER ROOM SANITARY";
 "BRS";
 "MANAGER";
 "MAN";
 "ELEKTRICIANS";
 "ELE"
 ) || Switch(
 cboLocationSubRoom.Selected.Value;
 "EXTERNS";
 "EXT";
 "HUMAN RESOURCES";
 "HR";
 "ADMINISTRATION";
 "ADM";
 "MEETING ROOM";
 "MR";
 "CONTROL ROOM";
 "CR";
 "STAFF MESS ROOM";
 "SMR";
 "KITCHEN";
 "KIT";
 "SANITARY MEN";
 "SM";
 "SANITARY LADIES";
 "SL";
 "SANITARY TANKPARK";
 "ST"
 ) || Switch(
 cboLocationSubRoom.Selected.Value;
 "LABO ARCHIVES";
 "LAR";
 "ARCHIVES";
 "AR";
 "MEZANNINE";
 "MEZ";
 "BOX";
 "BOX";
 "SHELF";
 "SHF"
 ) & "/" & If(
 Not(cboLocationSubRoom.Selected.Value = "BOX" || cboLocationSubRoom.Selected.Value = "SHELF");
 Switch(
 cboLocationContainer.Selected.Value;
 "SHELF";
 "SHF";
 "DRAWER";
 "DWR";
 "BOX";
 "BOX"
 ) & "/" & txtNumberShelfRack.Text
 ))
 }
);;
Set(
 PopUpStockChangePlace;
 false
);;

 
 


Kind regards,

 

Sébastien
 

  • PonceletSeba Profile Picture
    81 on at
    Re: compounded string returning "false"

    Thanks @WarrenBelz , this made my code maintainable.

    Kind regards,

     

    Sébastien

  • Verified answer
    WarrenBelz Profile Picture
    148,546 Most Valuable Professional on at
    Re: compounded string returning "false"

    Hi @PonceletSeba ,

    Try putting all the code matches in the table at the top and then using this structure

    With(
     {
     _Codes:
     Table(
     {Value: "BIOPOWER", Code: "EBO"};
     {Value: "GREENPOWER", Code: "EGO"};
     {Value: . . . . . . . 
     )
     },
     Patch(
     Wisselstukken;
     {'Id (ID)': galStockList.Selected.'Id (ID)'};
     {
     Place: 
     Lookup(
     _Codes;
     Value = cboLocationSite.Selected.Value
     ).Code & "/" & 
     Lookup(
     _Codes;
     Value = cboLocationMainRoom.Selected.Value
     ).Code & "/" & 
     Lookup(
     _Codes;
     Value = cboLocationSubRoom.Selected.Value
     .Code & 
     . . . . . . .

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1