Baanboard.com

Go Back   Baanboard.com

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
35%
Installation Wizard into new VRC
42%
Manual into existing VRC
3%
Manual into new VRC
19%
Total votes: 31

Baanboard at LinkedIn


Reference Content

 
Using program variables
By patvdv at 26 Feb 2008 - 21:56

Using program variables

As a 4GL query is handled via the bshell, you can directly relate program variables to it. Linking program variables is required for both the SELECT clause and the WHERE clause.

SELECT clause

In the <select list> of the SELECT clause, program variables are used to indicate the elements in which the query results must be stored. You can do this by explicitly specifying a program variable. The general syntax is:

<select part>:<program variable>

For example:

SELECT ppmod123.field1:my_val1

Or you can directly use a program variable (a table or field name) from the calling program in the <select list>. For example:

SELECT ppmod123.field1

In the first example, the program places the result in the <program variable>. In the second example, the name in the query and the name of the program variable are identical.

WHERE clause

You can also use program variables in the WHERE clause. When evaluating the query, the program loads the values of the program variables into the query and includes them in the evaluation. This link can be realized by incorporating a program variable in the query, preceded by a colon [:]. For example:

WHERE ppmod123.field1 = :myval1

Note

A table field can be a program variable as well as a query variable. Note that the following query:

 select tccom010.*
 where tccom010.cuno = tccom010.cuno

has a different result from:

 select tccom010.*
 where tccom010.cuno = :tccom010.cuno

The latter selects one record; the former selects all records from the table tccom010, as tccom010.cuno by definition equals tccom010.cuno for each row.

Related topics



0
No votes yet


All times are GMT +2. The time now is 22:23.


©2001-2017 - Baanboard.com - Baanforums.com