Using value from a field to bring up different data entry forms based on slices

I have a form that has one field on it (PI_NO). It asks the user to select a role out of 7 possibilities. I need to open a different form based on a slice of data dependent upon the role selected. In other words, instead of hiding and show fields based on the PI_NO value I want to use views based on slices to simplify things.

  1. How would I call the correct form based on the value of PI_NO?

  2. How would I pass that value (PI_NO) to the newly open form and fill in the PI_NO on that newly opened form?

Does this make sense?

Thanks.

Lucinda

So you open up the first form that has one Enum field, and you want to forward the user to another form dependent on the selection from that field?

Sounds like you need to do the following:

Create a UX->Action “App: go to another view within this app”
Enter an expression like this:

LINKTOVIEW(
SWITCH( [PI_NO],
“Value 1” , “Form 1”,
“Value 2” , “Form 2”,
etc… ))

Now go into the view settings for the first form, and under the Behavior section, set this action as the Row Selected action.

If you need to pass the value of PI_NO, or anything else, change LINKTOVIEW to LINKTOFORM.

1 Like

Marc,

Thank you for your quick response. I inputed an expression based on yours. But I hit another problem.

Screen Shot 2020-03-31 at 3.55.57 PM
But I can’t get the key field to properly set the value to UniqueID(). See the screenshot. I use this in another table and it works fine. I even deleted the table in the spreadsheet and started over.

Do you have any tips?

Thanks. Lucinda

What is the expression that you used?

1 Like

LINKTOVIEW(
SWITCH( [PI_NO],
“2” , “JFAPI_Data_Entry”,
“Enter Request” ))

I only have one data entry screen created, not the seven I will need.

As soon as I click save, I get the error about key field being required which I assume comes before the expression.

That error pops up preventing you from saving the first form?
There is no value being populated in that field that you can see?
How are you getting into that form in the first place?

I set that form as the opening form/view for the app.

I tried to set the key field to show but it keeps being hidden. It certainly appears that the UNIQUEID() is not populating that field before the record is being saved. I even tried setting the automatically created _rownumber field to be the primary key with UNIQUEID() but got the same error.

Ok. I set up another app just to test. I only had two tables and it worked. I went back to my app and made sure everything matched on this form. Still didn’t work. I renamed the action and deleted it from the Row Key and the record saved correctly. So it IS something with my action that is causing problems.

I’ll work on that aspect. I appreciate the time you’ve given me.

Lucinda

Here are my three attempts at writing the LINKTOFORM expression. I get errors each way I try it. I want to pass the PI_NO from the initial form to the proper data entry form selected by Role (PI_NO) in the initial form. Each form being called is based off a slice all from the same underlying table.

Any help will be appreciated. Thanks.

That last one should work, just missing a comma and opening quotes before PO_ID" near the end.

1 Like

A million thank you’s Marc. It works!!! I did find that I missed read your “Now go into the view settings for the first form, and under the Behavior section, set this action as the Row Selected action.”
I had to put it in the Behavior Form Saved section. See screenshot.

I sooooo appreciate your patience and help.

Lucinda

1 Like

Great. Oh yah, form saved, my mistake.

1 Like

I have two more questions. The PI_NO value gets pre-filled in on the proper form after saving the initial form. All good.

  1. I want to hide, or lock, the pre-filled field PI_NO on the data entry screens so the user can’t inadvertently change it. If they changed it, the data entry form they are on would no longer be the correct one.

  2. On the data entry forms, when the user saves the form, a new blank one is opened. It no longer has the PI_NO field pre-populated. Is there a way to have it use the value from the form just saved? Normally, the user would not need to change the PI_NO (role) during a session.

I guess I could force the user to go back to the opening screen and re-enter their role in the PI_NO field in the opening screen but I’d prefer to eliminate that extra step.

Thanks again for your help.

For #1, you could use a CONTEXT() expression in the Editable_If field.

For #2, you can create another LINKTOFORM form-saved action for this form. You can leverage the CONTEXT() expression again to use the same action for all 7 forms.

2 Likes

Great. I really appreciate it. I’ll give it a try.

Or just set Editable_If to FALSE. That prevents any user modification at any time, but still allows actions to modify it.

2 Likes

Thanks again. Got that all working. I created an Onboarding view with 7 screens of helpful tips.

How do I, 1. move to my opening form after the user finishes reading each tip? I created an Action to open my opening form but can’t see where I can add it to the Onboarding form.

  1. How do I add a button to skip the onboarding and go straight to the opening form? I could use my action to do this if I can figure out how to add a button to the Onboarding type of form.

Thanks.

I’m sorry I am not familiar with onboarding views. Please search this forum for more info about them, or maybe make a new topic.

1 Like

Thanks Marc. I did make a new topic. I just read every entry with the word Onboarding in it. Hopefully someone will know how to help. I have a work around until then.

Take care