Search code examples
gooddata

How to find the "Local Identifier" to execute AFM function using gooddata-js


I'm using gooddata-js in my project and I'm trying to use the function execution.executeAfm, but appears error about "Local identifier no found in AFM".

I followed the documentation about AFM and Result Specification, but I don't know where I find the "Local identifier" to put into itemIdentifiers. I tried put ['measureGroup'] but didn't work!

execution: {
                afm: {
                    measures: [
                        // Type: IMeasure
                        {
                            localIdentifier: '740953a40a01490c8aaeba66a21cac53',
                            // Type: MeasureDefinition
                            definition: {
                                measure: {
                                    // Type: ObjQualifier
                                    item: {
                                        uri: '/gdc/md/PROJECT_ID/obj/245828'   
                                    },
                                    filters: [
                                        // Type: IAbsoluteDateFilter
                                        {
                                            relativeDateFilter: {
                                                dataSet: {
                                                    uri: '/gdc/md/PROJECT_ID/obj/3603'
                                                },
                                                from : 0,
                                                granularity : 'GDC.time.month',
                                                to : 0
                                            }
                                        },
                                    ],
                                    computeRatio: false
                                }
                            },            
                        }
                    ]
                },
                resultSpec:
                {
                    dimensions: [
                        {
                            itemIdentifiers: ['gdc.visualization.table']
                        }
                    ]
                }
            }

I expect result of AFM function but show the error below!

error: {errorClass: "com.gooddata.webapp.service.executeafm.exception.LocalIdentifierNotFoundException",…}
component: "Webapp"
errorClass: "com.gooddata.webapp.service.executeafm.exception.LocalIdentifierNotFoundException"
errorCode: "gdc111"
errorId: "fe33be5e-cf0f-4195-b8eb-f28acafd8890"
message: "Local identifier=%s of type=%s not found in AFM."
parameters: ["gdc.visualization.table", "AttributeItem"]
0: "gdc.visualization.table"
1: "AttributeItem"
trace: ""

Solution

  • You are looking for a documentation of resultSpec available here:

    https://sdk.gooddata.com/gooddata-ui/docs/result_specification.html

    From your code snippet, I can only guess that a valid resultSpec could look something like this:

    {
      "dimensions": [
        {
          "itemIdentifiers": [
            "measureGroup"
          ]
        },
        {
          "itemIdentifiers": []
        }
      ],
      "sorts": []
    }