cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Flashback
Helper I
Helper I

Lookup result refer to other label

Hello,

 

i would like to ask, if have a my problem any solution.

 

I have Label1 where name of SQL column is made from Concatenate text and Dropdown.

 

I have this lookup function in other Label2

LookUp(CachedBallances, ComboBox3.Selected.helpEtalon = CodeBalance, here i need refer to Label1 with column name)

 

If i use LookUp(CachedBallances, ComboBox3.Selected.helpEtalon = CodeBalance, Label1.Text) in Label2 i have name of the column but i need his value.

 

Exist any way?

Thank you very much

Br

Jakub

1 ACCEPTED SOLUTION

Accepted Solutions

@Flashback 

Welcome to PowerApps!!

 

So the issue you have is not with the LookUp formula, it is that you seem to be putting this in a Label text property.

If that is the case, LookUp returns a Record.  Text expects a text value.  

So, you need to change your LookUp to choose the column you actually want to display in your label:

LookUp(CachedBallances,
    CodeBalance = ComboBox3.Selected.helpEtalon &&
    Switch(Label1.Text, 
        "TargetValueEtalon4", TargetValueEtalon4,
        "TargetValueEtalon5", TargetValueEtalon4
    ),
    theColumnYouWantHere
)

Replace theColumnYouWantHere with the name of the column you want to display.

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

View solution in original post

3 REPLIES 3
RandyHayes
Super User
Super User

@Flashback 

You cannot refer to objects, columns, filed names, controls, etc. by reference in PowerApps.

You can vote on this Idea in the idea forum. 

 

What you can do is devise a formula to swith off of the value in your label, such as this:

LookUp(CachedBallances,
   CodeBalance = ComboBox3.Selected.helpEtalon &&
   Switch(Label1.Text,
        "columnA", columnA = something,
        "columnB", columnB = something
   )
)

 

Replace strings with your label values and column names and criteria with yours and this will give you what you want as a workaround.

 

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!

Im new in powerapps and im not sure if understand...

 

I try this:

 

LookUp(CachedBallances,CodeBalance = ComboBox3.Selected.helpEtalon &&
Switch(Label1.Text, "TargetValueEtalon4", TargetValueEtalon4,"TargetValueEtalon5", TargetValueEtalon4))

 

But i still receive error "Expected Text value"

 

"TargetValueEtalon4" is name of column in SQL (decimal place type) and TargetValueEtalon4 - here i need value from this column (for example 1.000)

 

What i have wrong?

 

Thank you

BR

Jakub

 

@Flashback 

Welcome to PowerApps!!

 

So the issue you have is not with the LookUp formula, it is that you seem to be putting this in a Label text property.

If that is the case, LookUp returns a Record.  Text expects a text value.  

So, you need to change your LookUp to choose the column you actually want to display in your label:

LookUp(CachedBallances,
    CodeBalance = ComboBox3.Selected.helpEtalon &&
    Switch(Label1.Text, 
        "TargetValueEtalon4", TargetValueEtalon4,
        "TargetValueEtalon5", TargetValueEtalon4
    ),
    theColumnYouWantHere
)

Replace theColumnYouWantHere with the name of the column you want to display.

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

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.

Top Solution Authors
Top Kudoed Authors
Users online (2,989)