we are trying to get a math formula for our users with their own number type custom fields.
we keep data as json
example json:
{
“name”: “John Doe”,
“age”: 30,
“email”: “john.doe@example.com”,
“isVerified”: true,
“newsletter”: true,
“email_notifications”: true,
“sms_notifications”: false,
“home_address”: “123 Main St, Anytown, Anystate, 12345”,
“work_address”: “456 Office Blvd, Businesstown, Businessstate, 67890”,
“account_balance”: 250.75,
“reward_points”: 1500
}
we want to use a dynamic expression for math fields which user can input a text and custom field together
for example
(reward_points*account_balance)/age
we think adding this values to a text field as a list of text,
as example:
(
reward_points
*
account_balance
)
/
age
after doing that we think we can do some expression like:

so if this text is a custom field it will extract the json with regex if it is not (so it is a text like /*-+) it will take the text
is it a right aproach for this kind of solutions ?
is there a more optimized way to do it?
for ui we are currently triying math.js local plugin
for backend we use backend calculator plugin
thanks for you help
I would use the operator for arbitrary text to isolate the reward_points and in the dynamic expression after arbitrary text use the operator converted to number, then select the * followed by arbitrary text again to isolate account_balance and again follow that by converted to number then / and again arbitrary text to isolate the age and again converted to number
thanks for you reply boston
the issue for that is our users have different custom fields so other person will have diffirent json keys and differrent math needs so none of this expressions data is static its all dynamic
system
Closed
5
This topic was automatically closed after 70 days. New replies are no longer allowed.