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

Invalid Argument Type. Can't use table values in this context

Hi all,

 

How do i correct this error - all i want to do is to search whether the values from the text boxes are contained as a record in a database but i'm struggling to search with both of them at once

 

ClearCollect(CurrentUser, {Name: TextInputUserName.Text, Password: TextInputPassword.Text});
If(CurrentUser exactin ManagerDatabase,
     Navigate(ManagerHomeScreen, None),
     Set(correct, false)
)

Many thanks,

Colleen

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Invalid Argument Type. Can't use table values in this context

Hi @Anonymous,

 

Please take a try to switch your formula as below:

ClearCollect(CurrentUser, {Name: TextInputUserName.Text, Password: TextInputPassword.Text});
If(first(CurrentUser) exactin ManagerDatabase,
     Navigate(ManagerHomeScreen, None),
     Set(correct, false)
)

If here you would like to match the records with the Exactin function, then the String entered should match exactly with the record stored in the Database, this also requires the schema of the collection matches the one defined in your database.

 

The other way to define the check condition is to use the Lookup function, for example:

If(first(CurrentUser).Name exactin ManagerDatabase.Name &&
First(CurrentUser).Password = Lookup(ManagerDatabase,
first(CurrentUser).Name exactin ManagerDatabase.Name,
Password), Navigate(ManagerHomeScreen, None), et(correct, false) )

Function reference:

Operators in PowerApps

Lookup function in PowerApps

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
SamPhillips
Level 8

Re: Invalid Argument Type. Can't use table values in this context

Can you not just say...

 

 

If(TextInputUserName.Text exactin ManagerDatabase.UserName && TextInputPassword.Text exactin ManagerDatabase.Password,
     Navigate(ManagerHomeScreen, None),
     Set(correct, false)
)

 

 

Anonymous
Not applicable

Re: Invalid Argument Type. Can't use table values in this context

I guess I could however that searches for the name and password separately. So theoretically someone could enter an incorrect password for their name, but correct to someone elses and it would still pass - This solution doesn't quite work in terms of validating passwords.

Community Support Team
Community Support Team

Re: Invalid Argument Type. Can't use table values in this context

Hi @Anonymous,

 

Please take a try to switch your formula as below:

ClearCollect(CurrentUser, {Name: TextInputUserName.Text, Password: TextInputPassword.Text});
If(first(CurrentUser) exactin ManagerDatabase,
     Navigate(ManagerHomeScreen, None),
     Set(correct, false)
)

If here you would like to match the records with the Exactin function, then the String entered should match exactly with the record stored in the Database, this also requires the schema of the collection matches the one defined in your database.

 

The other way to define the check condition is to use the Lookup function, for example:

If(first(CurrentUser).Name exactin ManagerDatabase.Name &&
First(CurrentUser).Password = Lookup(ManagerDatabase,
first(CurrentUser).Name exactin ManagerDatabase.Name,
Password), Navigate(ManagerHomeScreen, None), et(correct, false) )

Function reference:

Operators in PowerApps

Lookup function in PowerApps

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.