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 / Calculate Text values ...
Power Apps
Answered

Calculate Text values in TextInputs in Gallery

(0) ShareShare
ReportReport
Posted on by 986

Hi everyone,

My scenario was as follows:

On a page I had a galley which was taking inputs as text: Inputs- WFH and WFO. 

Sidhant_02_0-1675406757784.png

Default view: Before Entering any values, the 2nd drop-down will be replaced with a new drop down which has only two values in Items property: "WFH", "WFO"
 
Expected Outcome:

Sidhant_02_1-1675406928673.png


So I did try to use the same formula which I used for calculating number value

Sidhant_02_3-1675407232032.png

The above image might not be clear, but it says that the function value has some Invalid arguments. So please let me know what can be done and also to Reset values of labels, as for text input the reset is working but for labels the value remained the same

@Ramole 

Categories:
I have the same question (0)
  • Verified answer
    Ramole Profile Picture
    Super User 2024 Season 1 on at

    Hi  
    We need to change your code like below. 

    With(
     {
     m:Switch(tbMon.Text,"WFH",1),
     t:Switch( tbTues.Text,"WFH",1),
     w:Switch( tbWed.Text,"WFH",1),
     th:Switch( tbThurs.Text,"WFH",1),
     f:Switch( tbFri.Text,"WFH",1)
     },m+t+w+th+f
     )



     

    Make sure you this txMon to txFri to your control name and it should calcalute the label when entered WFH and WFO
    To Reset the controls

    Add this OnVisible of the screen 

    UpdateContext({locResetCont:true});UpdateContext({locResetCont:false});

    Add On text input Reset property inside gallery

    locResetCont


    Also is best to add at end of the patch code.

    UpdateContext({locResetCont:true});UpdateContext({locResetCont:false});

     

     

     

     

    Ramole_0-1675412076222.png

     

  • Sidhant_02 Profile Picture
    986 on at

    Hi Ramole, 
    Thanks for the solution it worked, text value was getting calculated as expected:

    Sidhant_02_1-1675432700520.png

     

    But for the reset part I did use the context variable onVisible property of the screen and then tried using the same variable inside text property of the label for WFH and WFO, but it was not valid

    Sidhant_02_2-1675432802591.png


    Regards,
    Sidhant





    Sidhant_02_0-1675432648006.png

     

     

  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    Hi @Sidhant_02 
    The variable locResetCont needs be input reset property inside the gallery not on the label 
    Also add this at end of your patch formula, so it will reset whenever you run the patch.  

     

    UpdateContext({locResetCont:true});UpdateContext({locResetCont:false});

     

    Let me know if need any more assistance will happy to assist you further.
     

  • Sidhant_02 Profile Picture
    986 on at

    Hi @Ramole ,
    Initially I was looking for Reset property in the gallery itself (here TimeSheetGallery_1) but I did not find any such property in the gallery so that's why I tried to use it on the label which did not work out

    Sidhant_02_0-1675663153416.png

    Also you have mentioned to use the UpdateContext after the Patch function but in my case I have not used the Patch function, instead I have used the following on Save:

    Sidhant_02_1-1675663229568.png


    Regards,
    Sidhant.

  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    @Sidhant_02 

    Hi 
    Use the variable on the text input reset property inside the gallery locResetCont

     

    locResetCont

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 509 Most Valuable Professional

#2
Haque Profile Picture

Haque 302

#3
11manish Profile Picture

11manish 265

Last 30 days Overall leaderboard