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.
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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,879)