cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

SQL If statement

Hello,

 

So i'm struggling for a while on a piece of code. Im fairly new to Power Apps. So i want to do an IF statement on a column customerID. Basically i want to check if the SelectedcustomerID exists in the customerID column. IF it doesn't my label should say "Not Signed".

 

This is what i have so far:

 

If(LookUp('[dbo].[signaturetest]',customerID=selectedCustomerID),"Signed","Not Signed")

 

So IF the selecterCustomerID exists in the customerID column my label should say Signed.

 

Thanks in advance,

 

Anthony

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Anonymous ,

Something like this should do it

If(
   CountRows(
      Filter(
         '[dbo].[signaturetest]',
          customerID=selectedCustomerID
      ) >0,
      "Signed",
      "Not Signed"
   )
)

 

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.

View solution in original post

2 REPLIES 2
WarrenBelz
Super User
Super User

Hi @Anonymous ,

Something like this should do it

If(
   CountRows(
      Filter(
         '[dbo].[signaturetest]',
          customerID=selectedCustomerID
      ) >0,
      "Signed",
      "Not Signed"
   )
)

 

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.

PaulD1
Super User
Super User

You might try:

If(LookUp('[dbo].[signaturetest]',customerID=selectedCustomerID, true),"Signed","Not Signed")

Note the third argument in the LookUp - true. Normally the third argument is for the name of the column whose data you want to return. If the third argument is blank the whole record is returned. If you set the third argument to true, it should return true only if the condition is met. 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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