Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Alteryx is here to help you solve your biggest data challenges. Read about the new Virtual Solution Center here.

Deserialize php script in Alteryx

5 - Atom



Does anyone know how to deserialize php script in Alteryx and dynamically rename the parsed fields?


Currently we are using text-to-column tool to parse the input and manually rename every field. We are looking for a easier way that can adapt to change in php formats..




The input may look like the following:


a:1:{i:0;a:12:{s:2:"id";s:5:"12345";s:6:"amount";s:5:"50000";s:6:"length";s:1:"6";s:4:"rate";s:5:"0.080";s:7:"version";s:3:"7.0";s:5:"ratio";s:4:"1.23";s:5:"index";s:6:"175.68";s:7:"created";s:19:"2017-10-25 15:26:15";s:12:"requested_by";s:8:"john.doe";}}

11 - Bolide

Because of the multi-dimensional nature of your data arrays, it would be hard to build a one size fits all approach that works for everything.  It's the same thing with complex JSON objects.


If you were to approach it, I think you'd need an iterative macro (maybe a nested iterative macro with sufficient depth to cover your maximum expected array dimension) to process each array.  There's no guarantee that two arrays at the same level will have the same set of elements, so you'd have to deal with the fact that different schemas are likely to pop out of it.


You can build multi-dimensional arrays and JSON objects that are almost impossibly complicated to convert into a normal table structure, so without some sort of ground rules on array structure it is going to be complicated.  I'll throw this in the 'someday' pile because it's an interesting problem, and wish you the best of luck.

13 - Pulsar

Honestly speaking, I don't know much about php script, but I would look into using Regex:


This just focuses on those "s" values.  If you need to maintain that hierarchy type structure (i.e. with the "a" and "i") you are likely going to need an iterative macro. 


If this doesn't get you closer, could you post your expected output?