Conditionally Hide or Show a Field

Any field in MOBIDI can be conditionally visible. This I set in Advanced tab in the field. Following is the samples for Show and Hide rules.

field_id value is on the Macro tab.

Örnek Açıklama
formData[‘field_id’] if field_id has value then show/hide
formData[‘field_id’] == ‘Ankara’ if field_id has value of “Ankara” then show/hide
formData[‘field_id1’] == ‘Ankara’ && formData[‘field_id2’] == ‘Çankaya’ if field_id1 value is “Ankara” and field_id2 value is “Çankaya” then show/hide
[‘Ankara’,’İstanbul’].indexOf(formData[‘afield_id])>=0 if value is field_id is Ankara or İstanbul than show/hide
formData[‘field_id’] > 3 if value of field_id is greater than show/hide
items.length > 0 if record has at least one attachments(photo, video..) than show/hide


Macros is used to automatically fill the field. For example, the county/region/building or facility may be filled by your location. This feature not only makes data entry faster but also error-prone.

There are 3 choices for macros.

Spatial Relation – DB

This option gets information from a spatial table from an external source. A shapefile or a spatial table in PostGIS. The tolerance is 40m.

(warning) This option works only if you are on the same server as MOBIDI Office installed.

Spatial Relation – Query

Almost Every record hence Query has location information. This choice uses a Query as the spatial data source.

Suppose you create a project for Site Management. If you have more than one site, every record must have site information in order to report or analyze per site. But entering site info for every record is a boring and error-prone method.

Spatial Relation – Query solves this problem.

Let’s design a form called “Construction Site”. Let this form contain the features of a construction site. The name of the site, the manager, photos of the place where the construction site will be set and more may in this form.

Let’s create another form and call it “Activities” and define values ​​such as activity, quantity, etc.

If we want to have site information in the activities form, we must use “Spatial Relation – Query”

To implement the above scenarios:

  1. Add a field named “Site info” to activities form.
  2. Select Construction Site record in the Query.
  3. Congrulations1. İt’s done. Now you will see the information about the site in every activity. You may choose to get Form Caption or Map Label.

Advanced Relation Macro

If the above features do not meet your needs this macro may solve them. This choice may require some IT knowledge.

Örnek Açıklama
context.Data.GetAttribute(“select_id”) == “Ankara” ? “değer1“ : context.Data.GetAttribute(“select_id”) == “İstanbul” ? “değer2“ The value depends on a slect filed. Value1 for Ankara, Value2 for İstanbul.
d.GetAttribute(“field_id1”) == “100” ?d.GetAttribute(“field_id2”)*5 If field_id1 is 1000 then our value will be 5 times the value of field_id2.
context.Data.record.GeometryObj!=null ? “Geo” : “Non Geo” Whether the record has geometry or not.
d.record.Device.MobileLicenseDepartment This field will be department of the user.
c[“mobidi”].CreateID(d,”field_id”,”Start_”) Set and automatic ID for the field_id. That sequence Start_1, Start_2 and so.

For more please check the Macros page.

field_id value is on the Macro tab.

Update empty values only?

If this option is not selected, the defined macro will crush the written values in any case. If checked, values previously entered in different ways are preserved. These values were entered manually or with a different macro. You do not need to mark it except in very special cases.