Hi, I am trying to assign a value to a global variable, On a txtlabel.text The formula is as follows:
If(ThisItem.PesoPriorizacion =1.0, gblOrden=1,
ThisItem.PesoPriorizacion=0.9,gblOrden=2,
ThisItem.PesoPriorizacion=0.98,gblOrden=3)
"Pesopriorization" is a percentage type value and , I am displaying this formula in a gallery, which contains multiple values. However, the formula always gives me "false" as a result. What is the error, how can I fix it?
Thank you very much
You can't set a global variable inside an individual record in a gallery. You also can't just assign a value to a global variable without using the Set() function. What you probably want is to put something like this in the OnSelect of the gallery itself. That will set the veariable when you select a record in the gallery.
if(self.selected.PesoPriorizacion =1.0, Set(gblOrden,1),
if(self.selected.PesoPriorizacion=0.9, Set(gblOrden,2),
if(self.selected.PesoPriorizacion=0.98,Set(gblOrden,3)))
The question is what do you want to display in the label inside the gallery? Are you trying to display what you are putting in glbOrden? YOu don't use a variable for that. If that is what you want this is the formula for the label.
If(ThisItem.PesoPriorizacion =1.0, 1,if(
ThisItem.PesoPriorizacion=0.9,2,if(
ThisItem.PesoPriorizacion=0.98,3)))
Hello @CamiloHU,
You need to set the variable, if you use = then its like true or false statement
If(ThisItem.PesoPriorizacion =1.0, Set(gblOrden,1),
ThisItem.PesoPriorizacion=0.9,Set(gblOrden,2),
ThisItem.PesoPriorizacion=0.98,Set(gblOrden,3))
Try above code 🙂
Please mark as Answer if it is helpful and provide Kudos
Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
Blog : https://microsoftcrmtechie.blogspot.com
I tried it and the label does not show any value and the warning changes to data type: number.
is this on the onselect property?
Signature:
If you appreciated my comments/responses please be sure to Like/Kudo them it really does make me smile 🙂 !
Link to the Power Platform Professionals United Kingdom User Group:
Hello @CamiloHU,
Can you please try this code in Label
If(ThisItem.PesoPriorizacion =1.0, 1,
ThisItem.PesoPriorizacion=0.9,2,
ThisItem.PesoPriorizacion=0.98,3)
Please mark as Answer if it is helpful and provide Kudos
Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
Blog : https://microsoftcrmtechie.blogspot.com
Normally the label will automatically cast the number to a string, but if it doesn't you can surround it with a Text() function to cast it or change the numbers like 1 to "1" in the formula.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.
User | Count |
---|---|
208 | |
98 | |
60 | |
51 | |
43 |
User | Count |
---|---|
258 | |
160 | |
85 | |
79 | |
57 |