Combining lookup fields into one string?

Zoon van Joop

New member
Hi, I am new to Runabase. I have the following question. I have a simple table, 'routes' with a combined field 'Route' and 5 lookup fields ('From', 'Via#1', Via#2', 'Via#3' and 'To'). Those 5 get their values from a second table 'places', field 'place'. Now I want to get a unique name of the route in the field 'Route' by combining Date+From+Via#1+Via#2+Via#3+To. I can't figure out how I could achieve that. Any tips? Michiel Firet, The Netherlands
 

Anti

Administrator
Staff member
We are glad to welcome you here, Michiel!

If you attach your project, then it would be possible to give more presize answer.

A Composite field is used to concatenate string data.
Formula example:
[From], [Via#1], [Via#2], [Via#3] and [To]

You can also use the String() function with a condition if you need to exclude some data from the result or display data depending on the condition (in a Composite field, you can use all the functions of document templates that do not generate pictures, barcodes and don't work with files).
Please note that if an Object field is used, then its field from which the data is obtained must also be specified, e.g.: [Via#1.Place].
 

Zoon van Joop

New member
Hi Anti, please find attached a draft version of my 'Scheepslog' database. When using the (lookup) fields in a composite field, I get the error message 'field [e.g. Vertrek] (=From)] does not exist. Your suggestion works when the fields are just normal text fields, but not when they get their value from an other table. What am I doing wrong? And is it possible to attached a string of the date to this 'Route' value? With regards, Michiel Firet
 

Attachments

Anti

Administrator
Staff member
Better, instead of zipping the project folder into a zip archive, use project export. In the Projects menu - right button on your project - Export. You will get a single file of minimum size with the *.rbase extension. Note: attached files are not placed into archive. In the same place in the Projects menu, you can import the project.

In the "Routes" object, delete the "Condition" condition field, and in the "Vertrek" field, delete the "Copy from" property.
Variant of the formula for the "Route" composite field:
[Vertrek.Pleknaam] - [Via #1.Pleknaam] - [Via #2.Pleknaam] - [Via #3.Pleknaam] - [Aankomst.Pleknaam]
But in order not to write extra "-", add the String functions to check the values of the fields: if they are empty, then nothing is displayed, otherwise, "-" is displayed:
[Vertrek.Pleknaam][String(Via #1.Pleknaam=?: - )][Via #1.Pleknaam][String(Via #2.Pleknaam=?: - )][Via #2.Pleknaam][String( Via #3.Pleknaam=?: - )][Via #3.Pleknaam] - [Aankomst.Pleknaam]

To update existing records, use the Apply button in the Composite field properties in the Constructor.
 

Attachments

Top