GenSQLStatement

From Plex-XML
Jump to: navigation, search

There are two ways to alter the SQL-Statement of a FindBrowse.

Contents

1. Alter the SQL-Statement in Plex

Open your FindBrowse and search for the GenSQLStatement subroutine. Everything your FindBrowse needs for a correct dynamic SQL-Select statement is done here.

As you can see in picture below there are two EditPoint where you should jump in to alter a statement.

GrnSQLStatement 01.png

select and from

GrnSQLStatement 02.png

The normal select and from part is generated in in the first call.
In the example above a format message is used to generate additional select fields in the statement (parameter &!1) is the SQLStatementSelect output from the call statement).
The from-part with the join is generated in a separate format message (parameter &!1) is the SQLStatementFrom output from the call statement)

where and order by

GrnSQLStatement 03.png

The normal where and order by part is generated in in the two function calls.
In the example above a if-clause checks if there is already a where statement. The where statement is altered by a format message.

hints

  • every normal SQL functionality provided by a FindBrowse like fulltext search, variable search fields, variable order by ect. should not be affected by your changes
  • don't forget to put additional select fields to the FetchData variable otherwise you won't see them in your output
  • don't forget to alter the BlockFetchSQL function if you like to fetch additional fields


2. Alter the SQL-Statement at runtime

Format Translation

GrnSQLStatement 04.png


Filter Entity

Personal tools