Choice selection value with leading spaces

Use this board to ask questions or have discussions with other Genie users.
Post Reply
ChristianB
New User
Posts: 4
Joined: Wed Apr 18, 2018 8:12 am
First Name: Christian
Last Name: Bufacchi
Company Name: IVY Group
Contact:

Choice selection value with leading spaces

Post by ChristianB »

Hello.

We have an issue with a select box that is loaded using a database driven selection.
We would like to restrict the list of items, using "choices selection criteria" and "choices selection value".
We set up those fields as follows :
choices selection criteria = ABMCU=?
choices selection value = ' R001'
The choice selection value has 8 leading spaces in our database field ABMCU.
This does not return any choice (the list is empty).

We tried also TRIM(ABMCU)=? together with 'R001' but it does not work.

Can you help us in fixing this problem ?

Thanks and regards.
Christian.
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: Choice selection value with leading spaces

Post by Scott Klement »

I tried this (I created a file with a field named ABMCU, gave it 8 leading blanks followed by R001) and it worked fine for me.

Two things that I noted:

1. You MUST do TRIM(ABMCU)=? in the selection criteria (but, you said you did that.)

2. You cannot include the quote marks. So the parameter value must be R001 and not 'R001' -- otherwise, it'll expect the data to also have quote marks in it.

Good luck
ChristianB
New User
Posts: 4
Joined: Wed Apr 18, 2018 8:12 am
First Name: Christian
Last Name: Bufacchi
Company Name: IVY Group
Contact:

Re: Choice selection value with leading spaces

Post by ChristianB »

Hello.

I tried exactly TRIM(ABMCU)=? and choice parameters value : R001 (without quotes) : it does not work.
Surprisingly TRIM(ABMCU)='R001' without any choice parameters value is working fine.
I also tried to bind the value to a program field that contains ' R001' without success.
I made several tests (see the attached word document) and I now have the feeling that the problem is only related to ALPHA fields.
I also attached the AS400 table I am using for this test as a SAVF (I had to rename it with the .txt to be able to attach it to this ticket).

A quick fix could be to build the choice selection criteria dynamically and get rid of the choice parameter value. Is that possible ?

Thanks for your support.
Christian.
Attachments
cbsavf.txt
(1.55 MiB) Downloaded 296 times
Genie select box issue.docx
(769.33 KiB) Downloaded 306 times
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: Choice selection value with leading spaces

Post by Scott Klement »

Hi Christian,

When I ran your example, I got an error. I don't know if you looked to see if you were getting any error messages? You didn't post it here.

an easy way to see an error is to set the ondbload event to code like this:

Code: Select all

if (!response.success) {
  pui.showLastError();
}
This tells Genie that when the SQL statement wasn't successful, it should show the error message on the screen.
More information about ondbload can be found here:
http://www.profoundlogic.com/docs/displ ... load+event

With that change, when I ran your example that used the parameter marker, I got this error:
cb_error.png
cb_error.png (5.11 KiB) Viewed 2629 times
Since you did not provide any error messages, I do not know if you received the same error? Please check and see if that is the case.

If you did get this error, you can fix it using the options shown here:
http://www.profoundlogic.com/docs/displ ... +as+EBCDIC

Once I enabled the "read db driven data as ebcdic" option from the preceding link, it worked properly for me.
cb_success.png
cb_success.png (5.8 KiB) Viewed 2629 times
ChristianB
New User
Posts: 4
Joined: Wed Apr 18, 2018 8:12 am
First Name: Christian
Last Name: Bufacchi
Company Name: IVY Group
Contact:

Re: Choice selection value with leading spaces

Post by ChristianB »

Hi Klement,
Waouh !
It works perfectly after adding pui["read db driven data as ebcdic"] = true; into custom.js.
Thank you so much.
Christian.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests