WorkMaze / JUST.net

JUST - JSON Under Simple Transformation (XSLT equivalent for JSON).
MIT License
174 stars 54 forks source link

How to use Transformed data within same transformation file? #210

Open Sangeetha-Murugesan opened 2 years ago

Sangeetha-Murugesan commented 2 years ago

Hi,

I am grouping the data based on the fields named 'priority' and 'saleStatus' and it returns response say temp , and now I want to get the count of the data which grouped under priority and saleOption based on the result 'temp'. Here is my transformer file :

{ "temp": "#grouparrayby($.data,saleStatus:priority,all)", "result": { "#loop($.temp)": { "#": [ "#copy($)" ], "count": "#length($.all)" } } }

But the result field always returns null. How to pass the resultant transformed data as input to next field?

Thanks !

Courela commented 2 years ago

"temp" is a property of the resulting transformation, it is not available to select right after it is created. "#applyover" was created for this purpose, using a temporary input and perform another transformation, but it was thought for simple actions with one function, not for performing a whole new transformation, having a #loop inside will not work.

I think the only way of doing this is to call for another Transform(), passing the result as input.

Sangeetha-Murugesan commented 2 years ago

Hi @Courela ,Thanks for the response. In my case, this needs to be performed in single transformation we cant go for another transformation by passing the previous transformation input to new Transform. Any other possibility to achieve this ?

Courela commented 2 years ago

Not that I'm aware of.