Data Master used to populate variable

Nate Maingard shared this question 5 years ago
Answered

Hi there!


I'm trying to create user-types with access to different pages based on the type of user logged in.


In my data master for users, I have three different user-types as a 'multicategory'. I want my variable 'usertype' to automatically be set as the type of user logging in when I click the 'sign-in' button. How would you recommend I do this please?


Thanks so much, starting to get the hang of this software and loving it!


All the best


Nate

Comments (13)

photo
1

I will create a sample prototype for you via email and send it on your ticket on Zendesk. I realize you have that follow up question to Albert.

photo
1

This is slightly different to what I was working on with Albert, we got that sorted, which was just how to create logged in users. Now I want to create user types, which is a little more confusing for me. Any way you can help would be amazing, thanks John!

photo
1

Ok, take a look at this example.


I created four screens: sign in, blue, red, and green and a data master.


User has to select what kind of user type he is by checking a checkbox in the category.


NOTE: The problem with this design is what if user selected, two or more categories, which screen should you redirect him to? I think you can figure this out yourself.


Here is my data master.


b6d0fec75cf6ec97df10892d1d587931


Drag and drop all the widgets you see on the screen shot below.


NOTE: I just dragged and dropped user type data field into canvas.


Then select the sign in button and add 'on Click' event. Press 'Add a condition' -> Drag and drop 'Category_1' to conditional expression builder -> drag and drop 'has' function -> enter the word 'blue' on the last field -> then link to blue screen


Do the same thing for red and green.


photo
1

OK, I think we're nearly there, but I don't want the user to have to select which type of user they are. They will do that when signing up for the website. When a they are singing in, I want users to automatically be taken to relevant pages based on which type of user they chose to be when they signed up.

photo
1

Would love to know what you think about my last comment when you have time please John :).


Thanks


Nate

photo
1

Hi Nate,


Your problem is harder than I thought as it uses data from data master. I'm getting close to solving it though. I need more time. Thanks.

photo
1

Thanks John, by the time I'm done with you you'll be the Grand Master of Prototyper ;)

photo
1

Here it is Nate.


I am going to write here how I did it so other users can use this as a reference and will also send you the prototype.


So, I have two screens: login page and welcome page.


On the login page, I have basic widgets: labels, input fields, and a sign in button.


I also have a data master.


313645e05fcd2563fad12785c8c92c72


On the sign in button, I added some 'on Click' events.


When username field or password is empty, show the error message. Else, when username and password matches a record on the datamaster, set a value on the 'Logged user' variable and also go to the welcome page.


Here's the value of the 'Logged user' variable.


Setting value on the variable is the hardest part on this example. But now that we have it, we can now use that variable to filter user types.


This is the welcome page.


You'll see that there are two labels, one says 'Welcome' and the other is the user name that you have to set the value of. There's also a dynamic panel with three panels. Each panel has a rectangle with different colors, blue, red, and green.


'On Page Load' I set the value of label to show the logged user.


And for the finale, I added three 'On Page Load' events to show the logged user's user type. It basically just matches the user type's color to the right panel.


Let me know if you have further questions.

photo
1

Please send a request to jim.support@justinmind.com so I can give you the prototype.

photo
1

John -


Can you tell me if my understanding is correct that VARIABLES and DATA MASTERS don't directly interact ?


It seems that Data Masters are readable only, whereas when the prototype needs to write and pass data around it uses Variables. True ?


Thanks,


Thad

photo
1

You can use variables and data masters together in some cases.


You can add data to data masters during the execution using the data master action.


For more info about how to use data grid/data master, we have lots of tutorials if you go to this page, http://justinmind.com/prototyper/lear.... Scroll down the page and go to Prototype and Simulate Forms and Datagrids section.

photo
1

Watched all those, and I'm missing something obvious, I think in the section of your explanation above "set a value on the 'Logged user' variable and also go to the welcome page. "


I don't see how that happens.


I want to log a user in with an ID, then utilize that user's attributes to drive content on subsequent pages. But I can't even get a direct text expression, var_user_firstname = Bob , to show up on the subsequent page, much less load from the Data Master. Can I share my prototype with you ?

photo
1

Aha - "select" function. Got it.