Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend operators and functions in expressionParser.js #687

Closed
fgalan opened this issue Oct 25, 2018 · 3 comments
Closed

Extend operators and functions in expressionParser.js #687

fgalan opened this issue Oct 25, 2018 · 3 comments
Assignees

Comments

@fgalan
Copy link
Member

fgalan commented Oct 25, 2018

Expression plugin includes a basic set of operators and functions in expressionParser.js. However, it could be extended with the following ones:

  • if(cond,then,else) function
  • Comparison operators: <, <=, >, <=
  • Logical operators: and, or, not
  • Bitwise operations: <<, >>, and, or, not
  • Math functions: sin, cos, abs, min, man, random, mod, floor, ceiling, round
  • String functions: uppercase, lowercase, replace, slice
@fgalan
Copy link
Member Author

fgalan commented Oct 26, 2018

Implemented by PR #688

@fgalan
Copy link
Member Author

fgalan commented Feb 22, 2019

Sometimes we need to use expressions to build JSON attribute values like this one:

{
   "devices":[
      {
         "device_id":"manu49",
         "protocol":"IoTA-UL",
         "entity_name":"manu49",
         "entity_type":"WasteContainer",
         "attributes":[
            {
               "name":"location",
               "type":"string",
               "expression": "{"type":"Point","coordinates": ["${@latitude}","${@longitude}"]}"
            },
            {
               "name":"fillingLevel",
               "type":"Number",
               "expression": "${@level / 100}"
            },
            {
               "object_id":"tt",
               "name":"temperature",
               "type":"Number"
            }
         ]
      }
   ]
}

Detail:

"expression": "{"type":"Point","coordinates": ["${@latitude}","${@longitude}"]}"

We should take this into account.

Not fully sure if this part of this issue or is somehow related with this more general one about JSON value attributes at CB: #549

CC: @manucarrace

@fgalan fgalan pinned this issue Feb 22, 2019
@fgalan fgalan self-assigned this Feb 22, 2019
@AlvaroVega AlvaroVega unpinned this issue Nov 24, 2020
@fgalan
Copy link
Member Author

fgalan commented May 27, 2021

Duplicated (somehow) of #1052. Closing.

@fgalan fgalan closed this as completed May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant