cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DM2
Frequent Visitor

Text(), sometimes not formatting

Gotcha's from the front 1.   Label.Text  set to...

 

Text(Value(Label_2_RqdCalc.Text) * Value(First(Filter(Dassumptions,Assumptions="Ass1")).Figure ),"[$-en-GB]#")

 

...and it displays blank, nothing at all.  Take the "[$-en-GB]#" out and it works fine, displaying 0.  

 

Problem was caused by formatting Label_2_RqdCalc.Text as text(......,"#kg").   Sticking kg on the end means Powerapps can no longer convert it back to a number (even using value). so it can't use it in the above calculation.   It CAN convert some formats. Currency ones are OK.

 

As always, obvious when you know!

2 REPLIES 2
RandyHayes
Super User
Super User

@DM2 

If you have additional text in a label beside digits, you can always use this approach to get just the numbers:

   Value(Match(yourLabel.Text, "\d*").FullMatch)

This will return just the digits in the text and strip off all the rest (like kg).

 

Also, consider not using First(Filter it is a performance hog as PowerApps needs to filter ALL records in your datasource first and then it just returns the first.  The function LookUp is preferable as it stops at the first record it finds.

    LookUp(Dassumptions, Assumptions="Ass1", Figure)

 

I hope this is helpful for you.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
DM2
Frequent Visitor

Nice one Randy. Thanks for both tips.  And yes, very useful.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,892)