Page 1 of 1

Database-Driven Grid w/Multiple parameter values

Posted: Thu Mar 10, 2016 6:12 pm
by mdruk1986
Hi all,
I have a display screen that i want to show transactions that are between two dates(Field ID's Date1,Date2), however i cannot get it to work. The selection criteria is as follows:

Code: Select all

YTDC='C' AND YDATE  >=? AND YDATE <=?
The parameter values are as follows:

Code: Select all

parameter value:  script: "1" + get("Date1").substr(6,2) + get("Date1").substr(0,2) + get("Date1").substr(3,2);
parameter value 2:  script: "1" + get("Date2").substr(6,2) + get("Date2").substr(0,2) + get("Date2").substr(3,2);
The event is fired from a onchange event for the Date2 field with the following code:

Code: Select all

applyProperty("Grid1", "parameter value", "1" + get("Date1").substr(6,2) + get("Date1").substr(0,2) + get("Date1").substr(3,2));
applyProperty("Grid1", "parameter value 2", "1" + get("Date2").substr(6,2) + get("Date2").substr(0,2) + get("Date2").substr(3,2));
applyProperty("Grid1", "field type", "grid");
getObj("Grid1").grid.refresh();
getObj("Grid1").grid.render();
If i remove the last AND clause from the selection criteria it works, however this is not what i need as that gives me records for everything greater than or equal to YDATE. Another note is that when i look at it in firebug, p1 is always equal to Date2 and p2 is 1. I have attached screen shots showing the firebug debugger and set up in visual designer. We are using version 5.3.2

Thanks for your help

Re: Database-Driven Grid w/Multiple parameter values

Posted: Mon Mar 14, 2016 4:12 am
by Scott Klement
In your network screen shot you can see it is returning only a "1" for parameter value 2. Since your code sets it to "1" followed by some substrings of "Date2", I'm guessing those substrings aren't working.

I would suggest debugging/troubleshooting your JavaScript code to determine what is going wrong.

1. Check if the get("Date2") is returning anything. If not, maybe the id of the widget is not "Date2", or maybe it is capitalized differently.

2. Check that the substr() code is correct.

3. Maybe split the code up so it's not all on one line, that'd make it easier to see what is wrong.

In any case, this looks like a bug in your code, not a bug in Profound UI.

Re: Database-Driven Grid w/Multiple parameter values

Posted: Mon Mar 14, 2016 5:05 pm
by mdruk1986
Scott,
I used an alert to check the output and everything looked right. Any other ideas i can look into.

Thanks

Re: Database-Driven Grid w/Multiple parameter values

Posted: Fri Mar 18, 2016 5:54 pm
by matt.denninghoff
Are you saying you set the value of "parameter value 2" to something like this:

Code: Select all

script: alert("1" + get("Date2").substr(6,2) + get("Date2").substr(0,2) + get("Date2").substr(3,2));
and the alert box text was more than just a "1"?

Re: Database-Driven Grid w/Multiple parameter values

Posted: Mon Mar 21, 2016 9:32 am
by mdruk1986
Matt,
That is correct, as example the date picker "Date2" was selected to be "03/03/16" the alert would show "1160303". This is the format that the dates are stored in the AS400, CYYMMDD. However, to make debugging easier I changed the date fields on the display screen to textboxes and changed the parameter values script to: get("Date1") and it still acted the same.

Re: Database-Driven Grid w/Multiple parameter values

Posted: Mon Mar 21, 2016 11:50 pm
by Scott Klement
Are you saying that applyProperty() is stripping everything after the "1" from your value? In other words, if you do this, would it work better?

Code: Select all

getObj("Grid1").pui.properties["parameter value 2"] = "1" + get("Date2").substr(6,2) + get("Date2").substr(0,2) + get("Date2").substr(3,2);
If you use that instead of applyProperty() and it works, then it'd indicate a bug in the applyProperty() API, which should be reported to support@profoundlogic.com as a bug to be fixed.

Re: Database-Driven Grid w/Multiple parameter values

Posted: Tue Mar 22, 2016 8:44 am
by mdruk1986
Scott,
The problem was reproduced by the support team and they are working on it.
Thanks

Re: Database-Driven Grid w/Multiple parameter values

Posted: Thu Mar 24, 2016 1:41 pm
by matt.denninghoff
For reference, this is support issue 2497. It seems to be a bug with the applyProperty() API. It's in the developer queue waiting for a fix.

Re: Database-Driven Grid w/Multiple parameter values

Posted: Fri Apr 22, 2016 4:10 am
by k2R400
It's OK now for the "parameter value 2" of the apply applyProperty() ?

Re: Database-Driven Grid w/Multiple parameter values

Posted: Fri Apr 22, 2016 4:18 am
by Scott Klement
This was fixed in Profound UI version 5.4.0