Skip to main content
Known Participant
Sep 26, 2022 12:14 PM UTC
Question

input : "x+y-x*y" x=10,y=5 output: 10+5-10*5 in our x place i updated 10, y place i updated 5

i tried but i did not get exact output, any one try this ..

a!localVariables(
local!expression: "x+y-x*y",
local!result: a!forEach(
items: enumerate(len(local!expression)) + 1,
expression: local!expression[fv!index]
),
local!arryIndex: {
x: wherecontains(touniformstring({ "x" }), local!result),
y: wherecontains(touniformstring({ "y" }), local!result),

},
local!etdata: a!update(
data: local!result,
index: { local!arryIndex.x, local!arryIndex.y },
value: { 10, 20 }
),
local!etdata
)

12 replies

Participating Frequently
Sep 26, 2022 12:18 PM UTC

What exactly you want to do ?

Known Participant
Sep 26, 2022 12:48 PM UTC

we have planing to  dynamic  expressions  implements mathematical operations

sunilc0007
Known Participant
Sep 26, 2022 12:40 PM UTC

What do you want to say or do by this expression?

stefanhelzle0001
Brainy
Sep 26, 2022 12:41 PM UTC

So I will place myself at the third place asking for the purpose of this.

Known Participant
Sep 26, 2022 12:43 PM UTC

that expression , we have implement mathematical operations

stefanhelzle0001
Brainy
Sep 26, 2022 12:47 PM UTC

OK, but why?

csteward
Brainy
Sep 26, 2022 2:32 PM UTC

I have no idea why, or if this is what you are looking for...but:

a!localVariables(
  local!expression: "x+y-x*y",
  local!x: 10,
  local!y: 5,
  
  substitute(
    substitute(
      local!expression,
      "x",
      local!x
    ),
    "y",
    local!y
  )
)

?

Known Participant
Sep 26, 2022 2:52 PM UTC

thank you brother, nice 

csteward
Brainy
Sep 26, 2022 2:57 PM UTC

Glad it works for you!  Feel free to mark this thread as correctly guessed in that case [emoticon:44a8a53ad3364ea78a16c5a3229f75bb]