146
Views
5
Comments
Solved
How to iterate in a database 

 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

 

2022-10-12 00-27-13
Ossama Ghanem
 
MVP
Solution

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

2020-09-23 07-54-30
DS

Ossama Ghanem wrote:

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

 Hey Ossama Thank you for the solution i tried your solution and fortunately i worked perfectly 

Thanks again 

Regards

Deep 

 

2018-10-29 08-31-03
João Marques
 
MVP

Hi 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

2020-09-23 07-54-30
DS

João Marques wrote:

Hi 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

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, 

Deep 

 

2022-10-12 00-27-13
Ossama Ghanem
 
MVP
Solution

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

2020-09-23 07-54-30
DS

Ossama Ghanem wrote:

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

 Hey Ossama Thank you for the solution i tried your solution and fortunately i worked perfectly 

Thanks again 

Regards

Deep 

 

2018-10-29 08-31-03
João Marques
 
MVP

Hi Deep,


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

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.