Announcement

Collapse
No announcement yet.

Global Variable to change when quick search executes

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

  • Global Variable to change when quick search executes

    Hi,

    I have a Grid that I want to open so it just shows the Quick search, so I have given a global value where 1=0 when the application runs so nothing shows, the problem is I want to then change global to 1=1 when the quick search runs on enter or button pressed. I initially thought set the variable 1=0 in ONapplicationinit then as the page refreshes set the variable 1=1 in Onscriptinit, but this does not work, can anyone help to show me how this might work.

  • #2
    First remove the where clause form your grid's SQL statement.

    SELECT field1, ... FROM table

    Use the following construct in the onScriptInit event.

    Code:
    if(empty({sc_where_current}))
    {
    	sc_select_where(add) = ' WHERE 1 = 0';
    }
    else
    {
    	sc_select_where(add) = ' AND 1 = 1';
    }
    This might give you something to work with.

    jsb

    Comment


    • #3
      Thanks JSB, problem solved.

      Comment

      Working...
      X