Log In Using Data Masters
In this example, simulate a registration form to validate that the username and password are those already stored in a Data Master. Name this one "User".
- Create the "User" Data Master.
- Add two attributes; one called User Name and the other Password.
- Select the descriptor and click OK.
- Move the new Data Master to the canvas and draw the fields on the registration form.
- Drag a button to the canvas.
- Link it to the screen that should be displayed if the username and password are correct.
To do so, add a condition in the Expression Editor that compares the data entered by the user with the data in the Data Master. Navigation is only allowed if they match. Click the Add Condition option in the Events tab and follow these steps:
- Move the Filter function in the List tab to the expression.
- Filter (___ , ___)
- In the first gap, drag the Data Master "User".
- Filter ( Data Master User, ___ )
- In the second gap, put the "=" function of the General tab.
- Filter ( Data Master User, ( ___ = ___ ))
- In the first gap of the "=" function, put the Username attribute of our Data Master.
- Filter ( Data Master User, ( User Name = ___ ))
- In the second, drag the input field that allows you to enter the username.
- Filter ( Data Master User, ( User Name = 5 ))
- Drag the "&" function between the last parenthesis and the right parenthesis of the "=" function so that the first parameter takes the whole "=" function.
- Filter ( Data Master User, [( User Name = 5 ) & ___ ])
- In the second gap, add another "=" function and repeat the steps you followed for Username.
- Filter ( Data Master User, [( User Name = 5 ) & ( password = 5 )])
This expression returns the users who have this username and password. But we need to convert it into a condition that will determine if it's true or false.
- Drag the Count function in the Lists tab in front of the Filter expression
Count[Filter ( Data Master User, [( User Name = 5 ) & (password = 5 )])]
- Move the "=" comparator in the General tab and enter "1" in the last gap.
Count[Filter ( Data Master User, [( User Name = 5 ) & (password = 5 )])] = 1
This expression browses all the values in the Data Master "User" and chooses the ones that have a user and password matching those entered in the form. It then counts the number of users that comply with this condition and, if there is one, in other word if it's true, it lets the user go to the next screen.
Back to all Tutorials