Difference between revisions of "Documentation/DevGuide/Forms/Parameters"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Robot: Changing Category:Forms)
 
(2 intermediate revisions by one other user not shown)
Line 6: Line 6:
 
|NextPage=Documentation/DevGuide/Forms/Data Aware Controls
 
|NextPage=Documentation/DevGuide/Forms/Data Aware Controls
 
}}
 
}}
{{DISPLAYTITLE:Parameters}}
+
{{Documentation/DevGuideLanguages|Documentation/DevGuide/Forms/{{SUBPAGENAME}}}}
 +
{{DISPLAYTITLE:Parameters}}
 
<!--<idltopic>com.sun.star.form.XDatabaseParameterBroadcaster;com.sun.star.form.XDatabaseParameterListener</idltopic>-->
 
<!--<idltopic>com.sun.star.form.XDatabaseParameterBroadcaster;com.sun.star.form.XDatabaseParameterListener</idltopic>-->
 
Data Aware Forms are based on statements. As with other topics in this chapter, this is not form specific, instead it is a functionality inherited from the underlying <idl>com.sun.star.sdb.RowSet</idl>. Statements contain parameters where some values are not specified, and are not dependent on actual values in the underlying tables. Instead they have to be filled each time the row set is executed, that is, the form is loaded or reloaded.
 
Data Aware Forms are based on statements. As with other topics in this chapter, this is not form specific, instead it is a functionality inherited from the underlying <idl>com.sun.star.sdb.RowSet</idl>. Statements contain parameters where some values are not specified, and are not dependent on actual values in the underlying tables. Instead they have to be filled each time the row set is executed, that is, the form is loaded or reloaded.
  
 
A typical example for a statement containing a parameter is  
 
A typical example for a statement containing a parameter is  
<source lang="sql">
+
<syntaxhighlight lang="sql">
 
   SELECT * FROM SALES WHERE SALES.SNR = :salesman
 
   SELECT * FROM SALES WHERE SALES.SNR = :salesman
</source>
+
</syntaxhighlight>
 
There is a named parameter <code>salesman</code>, which is filled before a row set based on a statement is executed. The orthodox method to use is the <idl>com.sun.star.sdbc.XParameters</idl> interface, exported by the row set.
 
There is a named parameter <code>salesman</code>, which is filled before a row set based on a statement is executed. The orthodox method to use is the <idl>com.sun.star.sdbc.XParameters</idl> interface, exported by the row set.
  
Line 22: Line 23:
 
# The master-detail relationship is evaluated. If the form's parent is a <idl>com.sun.star.form.component.DataForm</idl>, then the <code>MasterFields</code> and <code>DetailFields</code> properties are evaluated to fill in parameter values. For an example of how this relationship is evaluated, refer to chapter [[Documentation/DevGuide/Forms/Sub Forms|Sub Forms]].
 
# The master-detail relationship is evaluated. If the form's parent is a <idl>com.sun.star.form.component.DataForm</idl>, then the <code>MasterFields</code> and <code>DetailFields</code> properties are evaluated to fill in parameter values. For an example of how this relationship is evaluated, refer to chapter [[Documentation/DevGuide/Forms/Sub Forms|Sub Forms]].
 
# If there are parameter values left, that is, not filled in, the calls to the <idl>com.sun.star.sdbc.XParameters</idl> interface are examined. All values previously set through this interface are filled in.  
 
# If there are parameter values left, that is, not filled in, the calls to the <idl>com.sun.star.sdbc.XParameters</idl> interface are examined. All values previously set through this interface are filled in.  
# If there are still parameter values left, the <idl>com.sun.star.form.XDatabaseParameterListener</idl>s are invoked. Any component can add itself as a listener using the <idl>com.sun.star.form.XDatabaseParameterBroadcaster</idl> interface implemented by the form.The listeners then have the chance to fill in anything still missing.
+
# If there are still parameter values left, the <idl>com.sun.star.form.XDatabaseParameterListener</idl>s are invoked. Any component can add itself as a listener using the <idl>com.sun.star.form.XDatabaseParameterBroadcaster</idl> interface implemented by the form. The listeners then have the chance to fill in anything still missing.
  
 
<!--[BUG641+]-->
 
<!--[BUG641+]-->
Unfortunately, {{PRODUCTNAME}} Basic scripts currently cannot follow the last step of this procedure - there is a known implementation issue which prevents this.
+
Unfortunately, {{AOo}} Basic scripts currently cannot follow the last step of this procedure - there is a known implementation issue which prevents this.
  
 
{{PDL1}}
 
{{PDL1}}
  
[[Category:Documentation/Developers Guide/Forms]]
+
[[Category:Documentation/Developer's Guide/Forms]]

Latest revision as of 15:44, 21 December 2020



Data Aware Forms are based on statements. As with other topics in this chapter, this is not form specific, instead it is a functionality inherited from the underlying com.sun.star.sdb.RowSet. Statements contain parameters where some values are not specified, and are not dependent on actual values in the underlying tables. Instead they have to be filled each time the row set is executed, that is, the form is loaded or reloaded.

A typical example for a statement containing a parameter is

  SELECT * FROM SALES WHERE SALES.SNR = :salesman

There is a named parameter salesman, which is filled before a row set based on a statement is executed. The orthodox method to use is the com.sun.star.sdbc.XParameters interface, exported by the row set.

However, forms allow another way. They export the com.sun.star.form.XDatabaseParameterBroadcaster interface that allows your component to add itself as a listener for an event which is triggered whenever the form needs parameter values.

In a form, filling parameters is a three-step procedure. Consider a form that needs three parameters for execution.

  1. The master-detail relationship is evaluated. If the form's parent is a com.sun.star.form.component.DataForm, then the MasterFields and DetailFields properties are evaluated to fill in parameter values. For an example of how this relationship is evaluated, refer to chapter Sub Forms.
  2. If there are parameter values left, that is, not filled in, the calls to the com.sun.star.sdbc.XParameters interface are examined. All values previously set through this interface are filled in.
  3. If there are still parameter values left, the com.sun.star.form.XDatabaseParameterListeners are invoked. Any component can add itself as a listener using the com.sun.star.form.XDatabaseParameterBroadcaster interface implemented by the form. The listeners then have the chance to fill in anything still missing.

Unfortunately, Apache OpenOffice Basic scripts currently cannot follow the last step of this procedure - there is a known implementation issue which prevents this.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages