HOWTO - Sashipa development
You have a researchForm contains fields of the main table. You wish to add fields for searching in columns of a linked table too.
The shrewdness is to add linked tables to the SQL query of the result listForm.
Here is an example with the DemoContact database tables. We just add two fields of the Contact table in the ContactAddress researchForm.
<researchForm>
<title>Search for contact addresses</title>
<location x='10' y='10' />
<fieldContainer>
<textField>
<schemaColumnRef schemaColumn='tblContactAddress_ContactAddressLabel' />
</textField>
<textField>
<schemaColumnRef schemaColumn='tblContactAddress_AddressPostcode' />
</textField>
<textField>
<label>Contact name</label>
<schemaColumnRef schemaColumn='tblContact_ContactName' />
</textField>
<textField>
<label>Contact first name</label>
<schemaColumnRef schemaColumn='tblContact_ContactFirstname' />
</textField>
</fieldContainer>
<listFormRef listForm='FLtblContactAddress'>
<redefineBounds x='0' y='85' w='200' h='411' />
<selectQueryBuilder>
<fromStatementBuilder>
<fkJoin join='inner'>
<instanceFk schemaFk='fk_tblContactAddress_tblContact'/>
</fkJoin>
</fromStatementBuilder>
</selectQueryBuilder>
</listFormRef>
<researchFormCriteriaBuilder mode='and' emptyAction='stuck'
defaultSubEmptyAction='ignore' />
</researchForm>
|
Remark: it can be helpfull to specify labels for added fields.
NB: When executing, perhap's you'll have an error because a join is already done. It means that the included result listForm already contains the added join. You can easily fixe the problem by deleting the element selectQueryBuilder of the listFormRef.
© Copyright 2003 Sashipa-Melba Team. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License as much as this note clearly appears.