Hello I wanted to know is there any way to iterate String value in a database
Actually i am trying to create a login page where i am taking value from user in 2 local variables and checking it with a existing database,
issue : the condition is only checking and comparing 'Name & Password'(Local variables) with first value of database(i.e. 0th value of database) and it is not checking whole database,
Condition : Name(local variable) = GetloginCredentials.... .Name AND password(local variable) = GetLoginCredentials... . Password
Hi Deep,
You need to implement something like this:
The database could be iterated using the For Loop action. For each Cycle, run your condition against the current selected record in the database. If True, then run your True logic off the True branch of your condition. Otherwise if false, iterate to the next row.
Ossama
Ossama Ghanem wrote:
Hey Ossama Thank you for the solution i tried your solution and fortunately i worked perfectly
Thanks again
Regards
Deep
Yes, you can create a server action which receives input the name and password, does a query and returns if there is a match or not. Something like this:
In this client action, you call the server action created above and use the output that you want.
Note: as a good practice, password are stored encrypted in the Database so either your match will fail because of that or you want to rethink if you should store passwords not encrypted.
Best regards,
João Marques
João Marques wrote:
Hello Marques,
Thank you for the great idea I tried yours solution too, just wanted to ask being new to OutSystems, I don't really know how to encrypt the password input while storing in database, can you please guide me how to encrypt password row .
Thank you & Regards,
You can use Platform Password Utils actions for the passwords.
Still, regarding your situation, you should avoid doing for each loops if they have queries as it is less performant doing a single query than queries in for each.
Cheers,
João