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 / compounded string retu...
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
 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    155,779 Most Valuable Professional on at

    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

  • PonceletSeba Profile Picture
    81 on at

    Thanks @WarrenBelz , this made my code maintainable.

    Kind regards,

     

    Sébastien

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 477

#2
WarrenBelz Profile Picture

WarrenBelz 341 Most Valuable Professional

#3
11manish Profile Picture

11manish 317

Last 30 days Overall leaderboard