Edit Choice Selection Criteria with variables

Use this board to ask questions or have discussions with other Genie users.
Post Reply
sgonchigar2
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

Post by sgonchigar2 »

Hello, Is this possible use input value from prior text box in a criteria for the next text box?
Attachments
Edit_Choice_Selection.PNG
Edit_Choice_Selection.PNG (1.61 KiB) Viewed 53250 times
User avatar
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

Post by Ayla »

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.
sgonchigar2
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

Post by sgonchigar2 »

I tried that but didn't work.
Attachments
autocomplete.docx
(203.78 KiB) Downloaded 1578 times
User avatar
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

Post by Ayla »

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.
User avatar
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

Post by Ayla »

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.
sgonchigar2
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

Post by sgonchigar2 »

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.
User avatar
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

Post by Ayla »

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
Attachments
SC1.png
SC1.png (6.37 KiB) Viewed 53077 times
SC2.png
SC2.png (5.08 KiB) Viewed 53077 times
sgonchigar2
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

Post by sgonchigar2 »

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?
Scott Klement
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

Post by Scott Klement »

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.
  1. The original field will show the value selected with "choice options field". But, this value will no longer be submitted back to the server.
  2. A new hidden field is created. It will contain the value from the "choice values field", and is what is submitted.
In Ayla's example, I_12_29 is the state code. So based on sgonchigar2's post, he would like that to display something like "CA - California" so that the user can type either "CA" and select the state, or part of "California". So the next field ("I_13_29" in Ayla's example) shouldn't do get("I_12_29") because this will return "CA - California" and you only want the short code from the choice values field ("CA" in this example") not the full string.

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;
}
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:

Code: Select all

script: getCorrespondingValue("I_12_29")
The resulting fields will look like this:
i_12_29.png
i_12_29.png (11.09 KiB) Viewed 53066 times
i_13_29.png
i_13_29.png (12.61 KiB) Viewed 53066 times
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.)
sgonchigar2
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

Post by sgonchigar2 »

Thank you Scott and Ayla. That's exactly what I was looking for. It worked! Will use the suggested combo box approach.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest