[Bug-1276] Using Expression transform inside Expression Structure binding type

How do I use use the values passed into the transform? I’ve tried:

  • {value}.format
  • {value.format}
  • {value\format}
  • {value/format}
  • jsonGet({value}, 'format')
  • jsonGet(jsonFormat({value}), "format")

Nothing I’ve will get me the value I need.

I reckon I had this issue as well, I can’t remember if I ever worked it out. What I did work out though is that it’s not worth using an expression structure, since it’s easier and more visible to create them as custom props on the component instead, and reference them as normal.
To be honest, i’m not sure where I would ever use an expression structure :thinking:

However, just thinking about your problem now, can you just use {value} and {format} to read the two values?

No. You can’t use {value} and {format}. {value} contains the entire value {"value": 2520, "format": "#,##0.00"}

I think this might be the same issue as mine:

What version igntion are you running?


Could it be that the {value} is being passed as raw JSON and not as a JSON string?

What happens if you use: jsonGet(toStr({value}), "format")

I think the problem here is that you are using the wrong type of binding.

An expression structure is intended to return an object structure (hence the name). The props.text property of a label is expecting a value.

I’m not sure exactly what it is you’re trying to accomplish but it appears you’re wanting to format the text of the label. That seems more like a job for the stringFormat or numberFormat expressions than an expression structure.

I’m just guessing from what I’m seeing in your screen shot, but have you tried just a normal expression binding:


Of course you could also achieve this with a tag binding and a Format transform.

I don’t believe that the expression language understands the object that is being returned by the expression structure. However, if there is some reason you insist on doing it this way, the script transform does interpret the object correctly so a script like the following will work, you will only need to convert your format over to a valid python format string:

return '{:{}}'.format(value.value,value.format)
1 Like

You are indeed encountering the same issue as @nminchin . if you use the typeOf expression to investigate the type of data being returned from the Expression Structure, you’ll see that you’re attempting to work with a HashMap, which the Expression transform is not readily able to work with.

We have an open issue for this, though no ETA.

I get an error.

1 Like

Good to know.

is probably throwing an error because if you look at the original returned content from the expression structure you’ll see that there are no quotes.

Actually, doesn’t matter, quotes or not.

No Quotes:


No, my concern is that the content you are attempting to treat as a JSON has no quotes. I am not concerned about the value you are attempting to retrieve.

{key_1: value, key: value}

is not valid JSON.

{"key_1": "value", "key": "value"}

Is what one would expect when trying to then use jsonGet, so even if you cast the invalid JSON as a string, attempting to perform jsonGet will fail because you are not actually providing JSON.

Ah, I see, I misunderstood.

You are indeed correct. I would never do this in a project, but it does work if you make it valid JSON.