Announcement

Collapse
No announcement yet.

Problem with Variables

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Variables

    Following the exmple in Scriptcase WebSite i create a container application with a Control in one widget and a Grid Application in another one.
    The problem is that the grid not always refreshes with the correct parameters. Like the variables are not being updated so the query does not change and neither the summary

    I write this JavaScript code on a Button to refresh the Grid Application (Showing the Summary only) with the parameters set by the user.


    Code:
    url = "../COMPARATIVO_VENTAS_SUCURSAL/COMPARATIVO_VENTAS_SUCURSAL.php?desde='" + document.getElementById('id_sc_field_fecha_desde').value + "'&hasta='" + 
    document.getElementById('id_sc_field_fecha_hasta').value + "\'";
    alert(url);
    parent.document.getElementById('id-iframe-widget2').contentWindow.document.location.href = url;
    In the ScriptInit Event of the Grid Application i have this code.


    PHP Code:
    if (isset($_GET['desde'])) { 
        
    $DESDE =  $_GET['desde']; 
        [
    BEGIN_DATE] = $DESDE
    } else { 
        [
    BEGIN_DATE] = ' DATEADD(DD,0,DATEDIFF(DD,0,GETDATE())) '

    if (isset(
    $_GET['hasta'])) { 
        
    $HASTA $_GET['hasta']; 
        [
    END_DATE] = $HASTA
    } else { 
        [
    END_DATE] = ' GETDATE() '

    And this is my query


    Code:
    SELECT
    	R.BRANCH AS SUCURSAL,
    	R.AMOUNT AS MONTO,
    	DATEADD(DD,0, DATEDIFF(DD,0,R.DATETIME)) AS FECHA,
    	DATEPART(YEAR, R.DATETIME) AS ANO,
            CONVERT(varchar(5),r.datetime,103) AS DIAMES
    FROM RETAIL R
    WHERE (DATEADD(DD,0, DATEDIFF(DD,0,R.DATETIME)) BETWEEN [BEGIN_DATE] AND  [END_DATE])
    OR (DATEADD(DD,0, DATEDIFF(DD,0,R.DATETIME)) BETWEEN DATEADD(YY,-1,[BEGIN_DATE] ) AND DATEADD(YY,-1, [END_DATE]))
    Thank you very much.
    Regards,

    Maxi

  • #2
    Yo creo que tu puedes usar la funcionalidad de SC cuando tu haces una consulta, puedes colocar en el HEADER estos titulos y SC coloca los criterios que estas utilizando que se visualizan al lado del encabezado.

    Comment

    Working...
    X