cancel
Showing results for 
Search instead for 
Did you mean: 

how to catch a value from an input and pass it like a paremeter of grid

Former Member
0 Kudos

hello, i build a Javascript function that shows the actual date and time, im putting this date and time in an input but now i need to catch this date and time to pass it like a paremeter to my SQL Query... i already tried somethings like this in the end of the page..

var grid = document.grd_Cell.getGridObject();

grid.setParam(3, data_hora);

grid.setParam(4, data_hora);

but it throws an error: object doesn't support this property or method

regards

Mário

View Entire Topic
jcgood25
Active Contributor
0 Kudos

Your answer actually exists in your question

You mention wanting to impact your SQL Query, but in your JavaScript you are referencing the iGrid. The script assistant would have guided you to this solution, since the set parameter methods are only relevant for the query object.

var grid = document.grd_Cell.getQueryObject();

grid.setParam(3, data_hora);

grid.setParam(4, data_hora);

document.grd_Cell.updateGrid(true);

If you build your SQLQuery using

[SD] or [ED]

instead of

[Param.3] and [Param.4]

then the iGrid will also show the time refresh controls for the user to select their own dates, and would not need form input fields, etc.

Former Member
0 Kudos

hi Jeremy could you give an example because im using the datenow function but the information comes different from the database and i dont know why... could you give an examples using the SD and ED

regards

Mario

Former Member
0 Kudos

In your query template use something like this


Select  Col1, Col2
From MyTable
Where Mydate Between [SD] and [ED]

Edited by: Doug Holtke on Sep 17, 2009 6:40 PM

Former Member
0 Kudos

hello, when i use SD and ED i doesnt receive the correct values.

could you give some help...i do like that....i put SD and ED in SQL Query instead [Param.3] and [Param.4] and in the transaction i create StartDate and EndDate...one question when i create the StartDate and Enddate i put a date....and is current date? or use the date that i put there?

then when im runing the transaction the data that i received...doesnt make any sense...

regards

Mario

Former Member
0 Kudos

Hi,

Try to look at the this [Help|http://help.sap.com/saphelp_xmII115/helpdata/en/Business_Logic_Services/illuminatorsqlquery.htm]

In SQL query Action block pass the SD and ED to QueryStartDate and QueryEndDate.

-Suresh