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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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