Announcement

Collapse
No announcement yet.

use of global variables in view

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

  • use of global variables in view


    Hello to all.
    Question: How can you send global variables to views to run manually assigned filters?

    simple example:

    view_1
    ------
    select nrmov, datamov, sum (amount) as amount from movc where [where_1]

    view_2
    ------
    select nrmov, datamov, amount from movc where [where_2]

    view_in_grid
    ------------
    select nrmov, datamov, amount from view_1 union (select nrmov, datamov, amount from view_2)

    Since there are several fields and a series of joins for each view I prefer to run the grid with the views that are more simplified and clear and then also because in grid complex queries are not performed correctly (it seems to me!)

    Ciao
    Thank you
    Enrico

  • #2
    Not sure what you want. A view is just like a table for scriptcase. In the sql part of scriptcase you can use global variables. You can do that in grid as well as in a form (in the select field).
    To set the globals you need some kind of trigger. That could be a button, a link, or if you call the grid from outside through a form, linking the data to the grid.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      thanks Albert for the answer.
      To simplify, from the example of my post, the global variables [where_1] and [where_2] of view_1 and view_2 are not taken into consideration when I run the query 'view_in_grid'
      Let me explain: I have a grid where in the onScriptInit event I configure the global variables [where_1] and [where_2] and in the SQL section I put the query

      select nrmov, datamov, amount from view_1 union (select nrmov, datamov, amount from view_2)

      well, the global variable filter [where_1] and [where_2] is not taken into consideration and lists all the records of view_1 and view_2!
      Thank you
      Ciao
      Enrico

      Comment


      • #4
        Well usually when the WHERE clause is dynamically generated, I pass the WHERE clause as global variable, for example I have a dashboard and unfortunatelly the search application just can be connected to forms, so I have to build my own search app by using a control application, then pass the built WHERE clause for all the apps inside the dashboard.

        Comment


        • #5
          thanks frank.
          Anhe I do as you say and use the passage of global variables.
          My problem, current, and send different global variables to queries that subsequently recall other queries! I need to merge multiple queries with different filters. I use the view both to simplify the thing and also because Scriptcase in grid does not handle well complex queries (in this case with the UNION clause).
          Example :
          query: select nrmov, datamov, amount from view_1 union (select nrmov, datamov, amount from view_2)
          where the view_1 has the filter [where_1] and the view_2 has the filter [where_2]
          Thank you
          Hello
          Enrico

          Comment

          Working...
          X