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

Getting the right columns with a simple IF statement (10 users trying and still can´t do it)

Hi PowerPros,

I have a table with 2 columns, and i want to populate a listbox with 1 of the 2 columns, depending on the value entered in the textbox.

 

The two columns are named ".RegraFranquia1" and ".RegraFranquia2."

 

The Textbox of the value is called "TextInputCapitalSeguro.Text"

 

Please se image atached for the warning. How can i get the right column?

 

 

 

 

22 REPLIES 22
vayinapurapu
Frequent Visitor

Looks like the formatting of the If condition is not right. I have seen the similar issue with If usage. Please refer to this blog

https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-use-else-if-condition/td-p/144705

Let me know if this helps or not. 

WarrenBelz
Super User
Super User

Hi @Ulisses ,

I free-type this, so mind the brackets and commas, but selection controls do not always like variable content

With(
   {
      colCapital:
      With(
         {vSelected:Value(TextlnputCapitalSequro.Text)},
         If(
            vSelected >= 7500 && vSelected < 15000,
            ComboBoxMercadoriasTransportadas.Selected.RegraFranquial,
            vSelected >= 15000,
            ComboBoxMercadoriasTransportadas.Selected.RegraFranquia2
         )
      )
   },
   colCapital
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

v-bofeng-msft
Community Support
Community Support

Hi @Ulisses :

It seems that RegraFranquia1 and RegraFranquia2 are neither text type nor number type.

Could you tell me what type of fields they are?

Best Regards,

Bof

Hello @WarrenBelz Thank for your time and help.

 

 I am getting the error, please see attached image. I am using the code in a listbox.

error2.png

Hi @Ulisses :

Could you tell me what RegraFranquia1 and RegraFranquia2's data types are?

I did a  test, when RegraFranquia1 and RegraFranquia2 are numeric or text types, no error is reported.

Best Regards,

Bof

 

 

Hi @v-bofeng-msft , thank you for your help. Numeric. 

Hi @Ulisses :

I suggest you check the value of TextImputCapitalSeguro.Text
If it is empty or less than 7500 or cannot be formatted as a number, then the error will also appear.

D4.gif

Best Regards,

Bof

@Ulisses ,

That was also an issue I was going to raise (values under 7500 were not catered for). Also I assume with your choice if fields, you were not looking for a table.

I can help you with this, but please tag whoever you want to continue with here as three-way conversations just confuse everyone.

 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

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