Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The filter parameter is complex. In the following example, which updates a sample inventory when the Done button is selected on the Signature page, you use the filter parameter to determine how to filter a dataset:

Code Block
\"filter\":\"27.CUSTREF1 = 16.CUSTSAMPLE and 27.CUSTREF2 = 15.CUSTLOTNUMBER�and15CUSTLOTNUMBER and15.CUSTPRODUCT = 16.uid and 15.uid in (select childid from me_datarelation where parenttype=7 and childtype=15 and (parentid=$7.uid or devicerowidparent=$7.uid ) )\"�

In this example, a dataset is returned under the following conditions:

...


All conditions are joined with AND statements, so only rows from the dataset that meet all conditions are retrieved. For every parent or child relationship that is in the data, there is an entry in the me_datarelation table.  The next table describes the columns in the me_datarelation table.

Column

Description

parenttype = MODULEID

The MODULEID of a parent, which specifies the records that have a particular parent object.

childtype = MODULEID

The MODULEID of a child, which identifies the data to which a particular child object is associated.

parentid =

Specifies the parent row ID of the record.

devicerowidparent =

You usually use devicerowidparent in conjunction with the parentid (explained in the previous row). The parentid only returns the the data source row ID, but devicerowidparent also includes any temporary row IDs stored on a device. This occurs if the device has not managed to synchronize with the the data source Server since the record was created.

childid =

Specifies the row ID of a child record.

devicerowidchild =

Specifies the temporary row ID stored on a device, if the device has not yet synchronized with the data source.

referencetype

Determines the type of reference field that is being filtered. Possible values follow. If no value is selected, then the default value is 4.

  • A value of 4 indicates REFERENCE fields.
  • A value of 14 indicates MULTI-ASSOCIATIONS.

...

This table describes an important flag that the filter parameter can also include.

Flag

Description

\"isfromscreen\":\ "yes\"

If the isfromscreen flag is set to Yes, then data is read from the current module before the record is saved. Any data that is already typed on a device by a user is read as part of the current query.

The isfromscreen flag is inserted at the end of the filter string after all field conditions used to determine the filter conditions are set. A comma is inserted and then the flag is defined, for example, as follows:

\"filter\":\"27.CUSTREF1 = 16.CUSTSAMPLE and 27.CUSTREF2 = 15.CUSTLOTNUMBER and 15.CUSTPRODUCT =
16.uid and 15.uid in (select childid from
me_datarelation where parenttype=7 and childtype=15 and (parentid=$7.uid or devicerowidparent=$7.uid ) )\",
\"isfromscreen\":\"yes\"