Edit Choice Selection Criteria with variables
-
- New User
- Posts: 13
- Joined: Fri Jan 28, 2022 6:47 pm
- First Name: Sunil
- Last Name: Gonchigar
- Company Name: NTT Data
- Contact:
Edit Choice Selection Criteria with variables
Hello, Is this possible use input value from prior text box in a criteria for the next text box?
- Attachments
-
- Edit_Choice_Selection.PNG (1.61 KiB) Viewed 54755 times
- Ayla
- Profound Logic Staff Member
- Posts: 5
- Joined: Wed Mar 31, 2021 12:08 pm
- First Name: Ayla
- Last Name: Dillis
- Company Name: Profound Logic Software, Inc.
- State / Province: California
- Contact:
Re: Edit Choice Selection Criteria with variables
Hello,
to input the value from another textbox you will need to set the choices selection criteria to BDBRAN = ? and set choices parameter value to script: get("I_6_20") for it to work.
to input the value from another textbox you will need to set the choices selection criteria to BDBRAN = ? and set choices parameter value to script: get("I_6_20") for it to work.
-
- New User
- Posts: 13
- Joined: Fri Jan 28, 2022 6:47 pm
- First Name: Sunil
- Last Name: Gonchigar
- Company Name: NTT Data
- Contact:
Re: Edit Choice Selection Criteria with variables
I tried that but didn't work.
- Attachments
-
- autocomplete.docx
- (203.78 KiB) Downloaded 1651 times
- Ayla
- Profound Logic Staff Member
- Posts: 5
- Joined: Wed Mar 31, 2021 12:08 pm
- First Name: Ayla
- Last Name: Dillis
- Company Name: Profound Logic Software, Inc.
- State / Province: California
- Contact:
Re: Edit Choice Selection Criteria with variables
Hi Sunil,
Thank you for your patience with this issue, our team has made an issue for you so we can continue investigating this for you, it's #7300. We will follow up with you as soon as we have an update.
Thank you for your patience with this issue, our team has made an issue for you so we can continue investigating this for you, it's #7300. We will follow up with you as soon as we have an update.
- Ayla
- Profound Logic Staff Member
- Posts: 5
- Joined: Wed Mar 31, 2021 12:08 pm
- First Name: Ayla
- Last Name: Dillis
- Company Name: Profound Logic Software, Inc.
- State / Province: California
- Contact:
Re: Edit Choice Selection Criteria with variables
Hello Sunil,
Thank you for your patience with this issue! We have put together an example video for you to reference:
https://www.youtube.com/watch?v=8Foe7JTyLI8
Please let us know if you have any further questions, we're happy to help.
Thank you for your patience with this issue! We have put together an example video for you to reference:
https://www.youtube.com/watch?v=8Foe7JTyLI8
Please let us know if you have any further questions, we're happy to help.
-
- New User
- Posts: 13
- Joined: Fri Jan 28, 2022 6:47 pm
- First Name: Sunil
- Last Name: Gonchigar
- Company Name: NTT Data
- Contact:
Re: Edit Choice Selection Criteria with variables
Thank you Ayla. The situation I have is. In your example, I am having 2 char State Code + ' - ' + State Name so user could search by either code or name. The code should get passed to the program and use the code for search of cities or another code + ' - ' + description. To give perspective, we would like to make the browser screens friendly to both existing users who are used to codes and new users who may not know the code but can search and know the code + description.
Examples: what gets displayed on the browser:
CA - California
NY - New Work
TX - Texas
what goes to the pgm is CA/NY/TX. This works now and shows expected results. You can see the attached screen shots from my previous example. Will be interesting to see how the SQL has to be written to accomplish the same. Guessing "select code , code || '-' || description from table where
code || '-' || like '%input value%' order by code"
Now, once user has made the state selection. have the state "code" in a variable/property value which is used to filter the result set of cities. Again we would like to display such that we have code + ' - ' + description but only code needs to go the program.
Auto complete text box Input 1 = code1 + ' - ' + description1, code1 should be returned to the program.
Auto complete text box input 2 = code2 + ' - ' + description2, the data should be filtered based on code1 and code2 should be returned to the program.
Examples: what gets displayed on the browser:
CA - California
NY - New Work
TX - Texas
what goes to the pgm is CA/NY/TX. This works now and shows expected results. You can see the attached screen shots from my previous example. Will be interesting to see how the SQL has to be written to accomplish the same. Guessing "select code , code || '-' || description from table where
code || '-' || like '%input value%' order by code"
Now, once user has made the state selection. have the state "code" in a variable/property value which is used to filter the result set of cities. Again we would like to display such that we have code + ' - ' + description but only code needs to go the program.
Auto complete text box Input 1 = code1 + ' - ' + description1, code1 should be returned to the program.
Auto complete text box input 2 = code2 + ' - ' + description2, the data should be filtered based on code1 and code2 should be returned to the program.
- Ayla
- Profound Logic Staff Member
- Posts: 5
- Joined: Wed Mar 31, 2021 12:08 pm
- First Name: Ayla
- Last Name: Dillis
- Company Name: Profound Logic Software, Inc.
- State / Province: California
- Contact:
Re: Edit Choice Selection Criteria with variables
Hello Sunil,
To accomplish what you are describing in the example that you are asking about, set the 'choice options field' to POSTSTATE || '-' || POSTCITY and then set 'contains match' to be true. I edited the textbox properties of the State, as seen in the Textbox Properties screenshot below. And by setting 'Contains Match' to true the program will search for any record that contains that text, you can see in the following screenshot 'WI' is typed into the State box and any record containing those characters is returned.
However, looking at your earlier forum posts it appears you were already doing this. Are you having some kind of problem using these properties? Is there something else you're trying to do? Do you need any specific information? Please let us know so we can better assist you!
Best,
Ayla
To accomplish what you are describing in the example that you are asking about, set the 'choice options field' to POSTSTATE || '-' || POSTCITY and then set 'contains match' to be true. I edited the textbox properties of the State, as seen in the Textbox Properties screenshot below. And by setting 'Contains Match' to true the program will search for any record that contains that text, you can see in the following screenshot 'WI' is typed into the State box and any record containing those characters is returned.
However, looking at your earlier forum posts it appears you were already doing this. Are you having some kind of problem using these properties? Is there something else you're trying to do? Do you need any specific information? Please let us know so we can better assist you!
Best,
Ayla
- Attachments
-
- SC1.png (6.37 KiB) Viewed 54582 times
-
- SC2.png (5.08 KiB) Viewed 54582 times
-
- New User
- Posts: 13
- Joined: Fri Jan 28, 2022 6:47 pm
- First Name: Sunil
- Last Name: Gonchigar
- Company Name: NTT Data
- Contact:
Re: Edit Choice Selection Criteria with variables
I need the "code" only from the 1st autocomplete be available for the 2nd autocomplete filter logic.
Say you select AK - Willow, for the autocomplete of cities, how to use/pass just state code to filter the list of cities. Wouldn't getObj("state") return "AK - Willow" and not just "AK". Would I be able substring and get the 1st 2 characters and use it in the cities filter?
Say you select AK - Willow, for the autocomplete of cities, how to use/pass just state code to filter the list of cities. Wouldn't getObj("state") return "AK - Willow" and not just "AK". Would I be able substring and get the 1st 2 characters and use it in the cities filter?
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Edit Choice Selection Criteria with variables
Hello,
When you add an autocomplete with "choice values field" specified on a 5250 screen with Genie, it will split the field into two fields.
As a quick example of how to get the value from the hidden field, I wrote a little function. This loops through the elements that will be sent back to the IBM i and looks for the element that contains the value field.
I recommend that you add the above code to the end of your Genie Skin's "custom.js" file. (At the very end, outside of any other functions.) An easy way to do that is to run the Genie Administrator, select your skin, and then click on the custom.js file. Paste the above function into it, and save your changes.
To make sure your Genie session picks up the changes (as opposed to an older, cached copy) click the "Refresh" button from the Genie toolbar in that session.
Now from your second field (the one with ID I_13_29 in Ayla's example) change the "choices parameter value" to this:
The resulting fields will look like this:
I must admit, this is something I haven't seen someone do before. But, if you code it like the example above, it should work.
(You could also consider using a combo box instead of an autocomplete -- I think this is more likely to be what someone would do on a 5250 screen.)
When you add an autocomplete with "choice values field" specified on a 5250 screen with Genie, it will split the field into two fields.
- The original field will show the value selected with "choice options field". But, this value will no longer be submitted back to the server.
- A new hidden field is created. It will contain the value from the "choice values field", and is what is submitted.
As a quick example of how to get the value from the hidden field, I wrote a little function. This loops through the elements that will be sent back to the IBM i and looks for the element that contains the value field.
Code: Select all
function getCorrespondingValue(widget) {
for (var code in pui.response) {
if (pui.response[code] != null && pui.response[code].fieldInfo != null && pui.response[code].fieldInfo.id === widget) {
return pui.response[code].value;
}
}
return null;
}
To make sure your Genie session picks up the changes (as opposed to an older, cached copy) click the "Refresh" button from the Genie toolbar in that session.
Now from your second field (the one with ID I_13_29 in Ayla's example) change the "choices parameter value" to this:
Code: Select all
script: getCorrespondingValue("I_12_29")
(You could also consider using a combo box instead of an autocomplete -- I think this is more likely to be what someone would do on a 5250 screen.)
-
- New User
- Posts: 13
- Joined: Fri Jan 28, 2022 6:47 pm
- First Name: Sunil
- Last Name: Gonchigar
- Company Name: NTT Data
- Contact:
Re: Edit Choice Selection Criteria with variables
Thank you Scott and Ayla. That's exactly what I was looking for. It worked! Will use the suggested combo box approach.
Who is online
Users browsing this forum: No registered users and 0 guests