0

Select Parent JSON Values, before and after array

I'm looking to select the parent value from a JSON datasource and repeat it for every item in an array.  Below are screenshots for the desired output and the source input.  Any assistance would be appreciated.

Desired output with the formulas being used.  Issues is the 'Company' and 'Machine' columns

Source JSON data

5 comments

  • 0
    Avatar
    Shima Beigzadeh

    Hi Scott, 

    Thanks for posting in our community! 

    One way to do this is actually using REPEAT () function to repeat the parent node for each item of your array. 
    For example: you can repeat "org" or "name" node for the specified number of times in your array. The items inside the COUNTALL() can be any of the nodes (size, label, used, etc)  as long as that node is available in every Array ( {1}, {2}, etc. ) 
    REPEAT(@name;, COUNTALL(@/mountpoint;)) 

    If you would like us to look into your datasource and create an example, please enable support access for us to have a detailed look. 

    Hope that helps! 

    Shima 

  • 0
    Avatar
    Scott Putman

    HI Shima, thanks for the quick reply.  I understand the functionality of repeat() and countable() functions but can't quite seem to make it work for my data set.  I've enabled support access as requested.  You may reference the database that includes "SP Volumes" for reference if you like.  Much appreciated.

  • 0
    Avatar
    Shima Beigzadeh

    Hi Scott, 

    Thanks for enabling the support access!

    That's right, looking into your JSON structure, we cannot use any of the nodes (size, label, used, etc),  since the items are not available for every array. 
    Instead what we can do, is using this syntax kf:names(object) to count the total numbers of arrays. 

    I have created one example in your account, called "KF Support test" to see how it is working. Please refer to and if you have more questions, do not hesitate to ask us. 

    Best, 
    Shima

  • 0
    Avatar
    Scott Putman

    Hi Shima, unfortunately I don't see the data source you mentioned.

  • 0
    Avatar
    Shima Beigzadeh

    Hi Scott, 

    I have sent you a direct email from Klipfolio support with details of your Klip information in it. 

    Thanks,

    Shima

     

Please sign in to leave a comment.