How to access parent JSON object on {{#each}}



  • Hello,

    My question is about exploring JSON data.
    Exemple of data:
    {
    "Depot":[
    {
    "COL_CODEACTIVITE":"01470",
    "ID":5,
    "RH":[
    {
    "COL_CODEACTIVITE":"01470",
    "COL_NOM":"AAAA",
    "COL_PRENOM":"BBBB",
    "TACHE":[{
    "TACH_LIBELLETYPE":"Prise de service Matin",
    "TACH_DATE_DEBUT":"2018-03-14T08:00:00",
    "TACH_DATE_FIN":"2018-03-14T08:00:00"
    },
    {
    "TACH_LIBELLETYPE":"Prise de service Après-midi",
    "TACH_DATE_DEBUT":"2018-03-14T14:00:00",
    "TACH_DATE_FIN":"2018-03-14T08:00:00"
    }]
    },
    {
    "COL_CODEACTIVITE":"01470",
    "COL_NOM":"RRRRR",
    "COL_PRENOM":"YYYYY",
    "TACHE":[{
    "TACH_LIBELLETYPE":"Prise de service Matin",
    "TACH_DATE_DEBUT":"2018-03-14T08:00:00",
    "TACH_DATE_FIN":"2018-03-14T08:00:00"
    }]
    }
    ]
    }
    ]
    }

    when I'm in {{#each RH}} how can i access ID of depot ?
    ("Depot" is the parent object of "RH")

    Thanks in advance :)


  • administrators

    hi! this is more like a handlebars question, check this part of handlebars docs, more specifically the ../ segment



  • or this google question :)



  • Perfect !
    Thanks to both of you !


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.