Difference between revisions of "FieldCalcConcatenate"

From TempusServa wiki
Jump to navigation Jump to search
old>Admin
(Created page with '= Calc: Concatenate = Making a text based on values from other fields Properties * Type: Complex * Groupable: No * Show in lists: Yes * Searchab…')
 
m (Actual version number)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Calc: Concatenate =
= Calc: Concatenate =
Making a text based on values from other fields
Making a text based on values from other fields.


Properties
Properties
Line 6: Line 6:
* Groupable: No
* Groupable: No
* Show in lists: Yes
* Show in lists: Yes
* Searchable: Yes
*Searchable: Yes


The field supports a basic version of [[Complex formulas]] as of version 6144, the last and innermost formula i calculated first. The separators ? and : has to have a space on both sides!
Supported comparisons and mathematics:
* One level of math, eg. <code>[FIELDX] + [FIELDY] == [FIELDZ] + [FIELDQ]</code>
* Supported mathematics are: plus, minus, divide, multiply and modulus
* Supported number comparators are: equal (= or ==), unequal (!=), less than (<), greater than (>), less than or equal (<=) and greater than or equal (>=)
* Supported text comparators are: equal (= or ==) and unequal (!=)
Samples of basic formulas:
{| class="wikitable"
!Expression
!Result
|-
|<code>( [FIELDX] > [FIELDY] ? X ([FIELDX]) is greater : Y ([FIELDY]) is greater )</code>
|Given that the value of both fields are numbers (int or float), and FIELDX has a greater value.
The result would be: <code>X ([FIELDX]) is greater</code>, where [FIELDX] would be replaced with the value of the field
|-
|<code>( [RADIO] = Yes ? User accepted : User didn't accept )</code>
|Given that [RADIO] is a [[FieldNumberBoolean]] and the TRUE value has been set to "Yes", if the user selects it.
The result would be: <code>User accepted</code>
|-
|<syntaxhighlight lang="js">
(
    [PROVIDER] = IMDB
    ? <a href="https://www.imdb.com/title/[ID]/">Link to IMDB<a/>
    : (
        [PROVIDER] = TheMovieDB
        ? <a href="https://www.themoviedb.org/movie/[ID]">Link to TheMovieDB<a/>
        : Unknown provider
    )
)
</syntaxhighlight>
|This is an example of two nested formulas, enabling comparison of an element against multiple values.
Given that [PROVIDER] is a string value (text, dropdown, etc), [ID] could be anything.
If provider equals "IMDB" a link to IMDB would show up, and the ID would be input.
If provider equals "TheMovieDB" a link to TheMovieDB would show up, and the ID would be input.
|-
|<code>( [ACCEPT] != YES ? <nowiki><a href=\"https://acme.com?( [X] > [Y] ? test1 : test2 )\">Link</a></nowiki> : <a href=\"<nowiki>https://acme.net?(</nowiki> [X] < [Y] ? test1 : test2 )\">Link<nowiki></a></nowiki> )</code>
|This is just an example of nesting.
|}


== User interface ==
== User interface ==
Field in show mode
Field in show mode:


[[File:FieldCalcConcatenate_show.png]]
[[File:FieldCalcConcatenate_show.png]]


Due to its nature this field has no special editing mode.
Due to its nature this field has no special editing mode.
User interface as displayed in picture


== Configuration ==
== Configuration ==
Line 25: Line 65:


Required:
Required:
* ''As shown above''
* An expression
 
Options:
* ''As shown above''
 


== Developer info ==
== Developer info ==

Latest revision as of 15:40, 4 January 2022

Calc: Concatenate

Making a text based on values from other fields.

Properties

  • Type: Complex
  • Groupable: No
  • Show in lists: Yes
  • Searchable: Yes

The field supports a basic version of Complex formulas as of version 6144, the last and innermost formula i calculated first. The separators ? and : has to have a space on both sides!

Supported comparisons and mathematics:

  • One level of math, eg. [FIELDX] + [FIELDY] == [FIELDZ] + [FIELDQ]
  • Supported mathematics are: plus, minus, divide, multiply and modulus
  • Supported number comparators are: equal (= or ==), unequal (!=), less than (<), greater than (>), less than or equal (<=) and greater than or equal (>=)
  • Supported text comparators are: equal (= or ==) and unequal (!=)

Samples of basic formulas:

Expression Result
( [FIELDX] > [FIELDY] ? X ([FIELDX]) is greater : Y ([FIELDY]) is greater ) Given that the value of both fields are numbers (int or float), and FIELDX has a greater value.

The result would be: X ([FIELDX]) is greater, where [FIELDX] would be replaced with the value of the field

( [RADIO] = Yes ? User accepted : User didn't accept ) Given that [RADIO] is a FieldNumberBoolean and the TRUE value has been set to "Yes", if the user selects it.

The result would be: User accepted

(
    [PROVIDER] = IMDB
    ? <a href="https://www.imdb.com/title/[ID]/">Link to IMDB<a/>
    : (
        [PROVIDER] = TheMovieDB
        ? <a href="https://www.themoviedb.org/movie/[ID]">Link to TheMovieDB<a/>
        : Unknown provider
    )
)
This is an example of two nested formulas, enabling comparison of an element against multiple values.

Given that [PROVIDER] is a string value (text, dropdown, etc), [ID] could be anything.

If provider equals "IMDB" a link to IMDB would show up, and the ID would be input.

If provider equals "TheMovieDB" a link to TheMovieDB would show up, and the ID would be input.

( [ACCEPT] != YES ? <a href=\"https://acme.com?( [X] > [Y] ? test1 : test2 )\">Link</a> : <a href=\"https://acme.net?( [X] < [Y] ? test1 : test2 )\">Link</a> ) This is just an example of nesting.

User interface

Field in show mode:

FieldCalcConcatenate show.png

Due to its nature this field has no special editing mode.

Configuration

This field requires configuration before deployment.

FieldCalcConcatenate BE.png

Required:

  • An expression

Developer info

  • FeltTypeID: 82
  • SQL datatype: text
  • Class name: FieldCalcConcatenate
  • Field is allowed in inline tables