Skip to Content
avatar image
Former Member

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Sep 17, 2009 at 01:43 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 17, 2009 at 01:46 PM

    - Removed by me, I thought you were trying to insert new data -

    Edited by: Doug Holtke on Sep 17, 2009 3:48 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 17, 2009 at 01:49 PM

    thanks for your answers, after some research i found that i can use the function datenow...

    regards and thanks

    Mário

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 18, 2009 at 09:21 AM

    hello, in my Sql Query i used the SD and ED like this...

    select sum(max(yieldqty)) as Max_Yield, sum(max(scrapqty)) as Max_Scrap

    from z_event

    where linenumber= '[Param.1]' and shiftnumber = '[Param.2]' and

    eventtimestamp >= and

    eventtimestamp <=

    group by ordernumber

    and in Data Range of Sql Query i changed to dd-MM-yyyy HH:mm:ss

    in my transaction i created in transaction properties (StartDate and EndDate) and in Configuring Links of my Sql Query and put like this...

    for StartDate: datefromxmlformat(Transaction.StartDate,"dd-MM-yyyy 00:00:00")

    and for EndDate: datefromxmlformat(Transaction.EndDate,"dd-MM-yyyy HH:mm:ss")

    then in my Xacute i call my transaction in Transaction Details i put in Mapped Param. Target i put linenumber and StartDate and EndDate...

    then in Start Date of Mapped input i put StartDate and in End Date of Mapped input i put EndDate....

    Question: what is Mapped Param. Target in Xacute?

    when i run it shows this....http://img35.imageshack.us/img35/4245/image1bv.jpg

    the startDate and EndDate have an interval of one hour..when i change StartDate and EndDate to test values that are 08-09-2009 00:00:00 and 08-09-2009 23:59:59 show me values that i like 😊 so the transaction is doing his job...

    so i only have one question...how can i put the StartDate to beggining of the day like..18-09-2009 00:00:00

    and EndDate to actual date and time...like this 18-09-2009 10:20:00

    regards

    Mário

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 18, 2009 at 10:23 AM

    hello, how to catch the value from this input:

    <input id="txt_datenow" type="text" readonly/>

    and then put this to a parameter.... i tried this: <param name="Param.3" value=document.getElementById('txt_datenow').value />

    but isnt working and i think that is wrong

    regards

    Mario

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 18, 2009 at 11:19 AM

    i tried with Javascript like this

    document.write("<param name=\"Param.3\" value=\"" + document.getElementById("txt_datenow").value + "\"/>");

    document.write("<param name=\"Param.4\" value=\"" + document.getElementById("txt_datenow").value + "\"/>");

    but isnt working too

    Edited by: Jeremy Good on Sep 18, 2009 9:31 AM

    Mio, since this post is already answered and has been moving to different, but related topics please start a fresh thread with your new question.

    Add comment
    10|10000 characters needed characters exceeded