cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
JunkoOhara
Level: Powered On

Lookup on Table "invalid argument type"

Hello,

I have a Table that contains Admin email address.

 

2018-10-23 12_03_31-ALL_BusinessCardOrder - Saved (Unpublished) - PowerApps.png

 

And would like to lookup (or Search or Filter, whatever that works..) to compare with the login user email and decide if the user is an admin or not.

But I get Invalid argument type error..

 

I'm not sure what PowerAPPs is expecting..

1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Lookup on Table "invalid argument type"

The Data Table control doesn't expose its items as an output property. In your case you defined the Items of the data table TbAdmin inlined (using the Table function). If you define it as a collection, then you should be able to reference that collection in your LookUp expression. For example, you can have this expression in the OnVisible property of your screen:

ClearCollect(
    Admins,
    {email:"john@doe.com"},
    {email:"jane@roe.com"},
    {email:"jim@poe.com"})

Then you can set the Items property of your TbAdmin to 'Admins' (the collection that was created on that screen).

And now that you have a collection that you can use, you can replace your LookUp expression with the following:

IsBlank(LookUp(Admins, email = txUserMail.Text))
3 REPLIES 3
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Lookup on Table "invalid argument type"

The Data Table control doesn't expose its items as an output property. In your case you defined the Items of the data table TbAdmin inlined (using the Table function). If you define it as a collection, then you should be able to reference that collection in your LookUp expression. For example, you can have this expression in the OnVisible property of your screen:

ClearCollect(
    Admins,
    {email:"john@doe.com"},
    {email:"jane@roe.com"},
    {email:"jim@poe.com"})

Then you can set the Items property of your TbAdmin to 'Admins' (the collection that was created on that screen).

And now that you have a collection that you can use, you can replace your LookUp expression with the following:

IsBlank(LookUp(Admins, email = txUserMail.Text))
samuelJ
Level 8

Re: Lookup on Table "invalid argument type"

Hi,

 

I am not very familiar with the Data Table control.  If it functions like a SQL table you could use CountIf() to achieve something of the same:

If( CountIf(dataSource, email = txUserMail.Text) > 0, //code for does exist, //code for doesn't exist)



JunkoOhara
Level: Powered On

Re: Lookup on Table "invalid argument type"

Thank you @CarlosFigueira and @samuelJ

I tried the CountIF but it still says Invalid Argument. 

It looks like you will need to create a collection first if you want to do something to the Table items.

 

After I created a collection, the CountIF worked fine.

Thank you so much!