Ask Your Question
1

How to use field path expression ?

asked 2018-12-14 02:59:49 -0600

lyon gravatar image

updated 2018-12-17 14:43:10 -0600

metadaddy gravatar image

I want to use field replacer to replace a field's value, but the field is undefined. The field's content is /*[${f:path() == '/control/switch/on' && f:value() == '1'}] but it's not working. Please help me with this.

When I try with /*[${f:path() == '/control' && f:value() == '1'}] it works for the field replacer, which is not my expectation.

I want to change corresponding values according to different paths and values, eg:

input:

{"control":{"power":0}}

output:

{"control":{"power":"off"}}

or input

{"control":{"power":1}}

output:

{"control":{"power":"on"}}
edit retag flag offensive close merge delete

Comments

I want to change to corresponding values according to different paths and values,eg: input {"control":{"power":0}} , output: {"control":{"power":"off"}} ,or input {"control":{"power":1}} , output: {"control":{"power":"on"}} . I don't know whether i express my meaning clearly,thank you very much!

lyon gravatar imagelyon ( 2018-12-16 18:43:50 -0600 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2018-12-17 09:21:08 -0600

iamontheinet gravatar image

Hi!

You can use Expression Evaluator with Field Expression set to ${record:value('/control/power') == 0 ? "off" : "on"}

Here's the result given "control": {"power":0}:

image description

Cheers, Dash

edit flag offensive delete link more

Comments

It's ok,thank you very much ! hope you hava a good day.

lyon gravatar imagelyon ( 2018-12-18 18:50:02 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-12-14 02:46:13 -0600

Seen: 114 times

Last updated: Dec 17 '18