Badges

Badges are how an existing Object type can be used in Maps and Cards components

We want to be able to have Cards and Maps which have clickable elements. Not only should they be clickable, but they should be the selection of a record, as with many other components in Logiak.

Then we can have these components as integral parts of chains of user interactions within an App - a point can be clicked and a record therefore identified, which can lead to other displays and functions relating to that record.

For example, if we have a system dealing in “incidents” of some kind, and the incident data includes a lat,lon pair, then we can have a map where the selection of a marker in the Map is a selection of a whole incident.

The problem Badges address

There are some components which require not only that you specify an Object type, but also that the Object has specific kinds of data which the component makes use of.

For example, to configure the Map component, as with many others, you simply specify an Object type.

Then, the Map component plots a location, one for each Object instance of the given type.

To plot points, the Object type evidently needs to contain the right kind of information: either latitude and longitude values (which makes it easy), or else some address information that we can use geodecoding to find latitude and longitude from.

So it seems like you would have to define Objects specifically for use in Map, with fields labelled “latitude” and “longitude”.

However, you might already have data with fields not named in that specific way. Maybe the fields are labelled “lat” and “lng” or something, and maybe it is very inconvenient or for whatever reason impossible to do so.

This is where Badges come in.

To use an Object with Map, it doesn’t have to have any specific names for fields, it just has to have the right kind of information. If it has the right kind of information, you can make it have the “location” Badge. Any Object type with the Location Badge can be used with Map.

How Object is given a Badge

All you have to do is to go into that Object, go to the Badges tab, and indicate from which field the latitude value should be taken, and from which field the latitude value should be taken.

Then your Object has the “Location” badge. The Map needs not a specific object, just any object with the Location badge.

Adding LOCATION badge to an Object called city

Polymorphism

In computing people use this fancy term to refer to when one can treat one thing as if it were also another thing (poly = many, morph = form).