• Resolved robinroos

    (@robinroos)


    Hi Bernhard

    I’m using the PRO plugin, which is excellent – thank you!

    Can you show me how to extract from an array?

    I’d like to get ID, SummaryValue and StateValue.

    SummaryValue is the Value property of the Field array element with Name=Summary.

    StateValue is the Value property of the Field array element with Name=State.

    Coincidentally these always occupy element positions [2] and [14] in the Fields array. I could depend upon this if required, but would prefer not to be brittle to field ordering changes.

    Thanks, Robin.

    https://ww.wp.xz.cn/plugins/json-content-importer/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter robinroos

    (@robinroos)

    [{“id”:”FITCAL-1″,”entityId”:”87-1″,”jiraId”:null,”field”:[{“name”:”projectShortName”,”value”:”FITCAL”},{“name”:”numberInProject”,”value”:”1″},{“name”:”summary”,”value”:”Report fixture to apply valuation datetime to the report before load”},{“name”:”description”,”value”:”The valDatetime is set on the PricingEnv, but that alone is not sufficient. Without this change the report is always run for \”today\”.”},{“name”:”created”,”value”:”1452850345569″},{“name”:”updated”,”value”:”1452850345569″},{“name”:”updaterName”,”value”:”robin”},{“name”:”updaterFullName”,”value”:”Robin Roos”},{“name”:”reporterName”,”value”:”robin”},{“name”:”reporterFullName”,”value”:”Robin Roos”},{“name”:”commentsCount”,”value”:”0″},{“name”:”votes”,”value”:”0″},{“name”:”Priority”,”value”:[“Normal”],”valueId”:[“Normal”],”color”:{“bg”:”#ebf4dd”,”fg”:”#64992C”}},{“name”:”Type”,”value”:[“Bug”],”valueId”:[“Bug”],”color”:null},{“name”:”State”,”value”:[“Submitted”],”valueId”:[“Submitted”],”color”:null}],”comment”:[],”tag”:[]}
    ,{“id”:”FITCAL-2″,”entityId”:”87-3″,”jiraId”:null,”field”:[{“name”:”projectShortName”,”value”:”FITCAL”},{“name”:”numberInProject”,”value”:”2″},{“name”:”summary”,”value”:”Report fixture always reports exceptions as if from TradeReport”},{“name”:”description”,”value”:”No matter what report type is being invoked, the report fixture always says it cannot find the TradeReport template if the nominated\ntemplate is missing.”},{“name”:”created”,”value”:”1452850416582″},{“name”:”updated”,”value”:”1452850416582″},{“name”:”updaterName”,”value”:”robin”},{“name”:”updaterFullName”,”value”:”Robin Roos”},{“name”:”reporterName”,”value”:”robin”},{“name”:”reporterFullName”,”value”:”Robin Roos”},{“name”:”commentsCount”,”value”:”0″},{“name”:”votes”,”value”:”0″},{“name”:”Priority”,”value”:[“Normal”],”valueId”:[“Normal”],”color”:{“bg”:”#ebf4dd”,”fg”:”#64992C”}},{“name”:”Type”,”value”:[“Bug”],”valueId”:[“Bug”],”color”:null},{“name”:”State”,”value”:[“Submitted”],”valueId”:[“Submitted”],”color”:null}],”comment”:[],”tag”:[]}
    ]

    Thread Starter robinroos

    (@robinroos)

    So I’m looking to get (/ is only there to visually separate fields in this post):

    FITCAL-1 / Report fixture to apply valuation datetime to the report before load / Submitted
    FITCAL-2 / Report fixture always reports exceptions as if from TradeReport / Submitted

    Thread Starter robinroos

    (@robinroos)

    I tried the following in the hopes that [] could be used to index arrays, but without success:

    {id} {field[2].value} {field[14].value} <hr>

    Plugin Author berkux

    (@berkux)

    Hi robin,

    try
    {id} / {subloop-array:field:3,3}{field.value}{/subloop-array:field} / {subloop-array:field:15,15}{value.jcix:####-1##}{/subloop-array:field}

    Best
    Bernhard

    PS This is PRO-Version only…

    Thread Starter robinroos

    (@robinroos)

    Interestingly the following DOES work:

    {id} / {subloop-array:field:3,3} {value} {/subloop-array:field} / {subloop-array:field:15,15} {valueId.jcix:####1##} {/subloop-array:field}<hr>

    but it is coincidental that there happens to be a valueId[] which contains the same data as value[].

    If I try to “jcix” into “value” then I get no output, so the following DOES NOT work:

    {id} / {subloop-array:field:3,3} {value} {/subloop-array:field} / {subloop-array:field:15,15} {value.jcix:####1##} {/subloop-array:field}<hr>

    I’d be keen to understand why “value” cannot be scoped in this position.

    Thanks for the help so far. Any chance you could support
    value[1]
    as a syntax alternative for the less intuitive
    {value.jcix:####1##}
    ?

    Kind regards, Robin.

    Thread Starter robinroos

    (@robinroos)

    Bernhard, I’m moving this to Not Resolved in the hopes that we can establish why {value} cannot be scoped in the second context.

    If you prefer I open a separate ticket then I will do so happily.

    Thanks, Robin.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Extract known elements from an array’ is closed to new replies.