Decisions Example 2: Data Retrieval and Variable Message |
This decision retrieves the total salary of the department currently displayed, and can be called from the Action property of a "Show Total" button. Decision SQL SELECT sum(sal) FROM emp WHERE deptno = :DEPTNO Yes Action MessageInformation(FORMULA(':1 || :2', 'Total salary for this department is ', :1)) This example illustrates that output values from Decision SQL can be passed to the Yes Action script using placeholders: :1, :2. The placeholder :1 at the end of this statement represents the first output value of the SELECT statement. Notice that it is not quoted. Do not confuse these placeholders with FORMULA placeholders. Often, as in this example, the two occur together. FORMULA() is needed here to concatenate the total salary with the rest of the message. The total salary is first passed as a query result to the :1 placeholder at the end of the statement, and from there to the FORMULA() method, where it is called :2 because it happens to take second place in the concatenation. No Action MessageInformation('There are no employees in this department.') You cannot use placeholders in No Actions. However, you can use references to on-screen values (:DEPTNO) if required. |