Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
yuhuangli
Contributor
Contributor

questiion for using enigmajs to create masteritem measure in qliksense

Hello

I am facing a weird issue and need help.

I am trying to use enigamajs to automate the creation of a master item measure.

I tried with engine API explorer and it worked well, after i run the code, i can see the masteritem measure is created in the app.

But later when  I tried to create a simple html with javascript code, there is no error message, but the master item measure is not created in the app.

Could any one check and advice what is the problem?

#######code is below#####################################

<html>

<head>
    <script src="https://unpkg.com/enigma.js/enigma.min.js"></script>
    <script>
            .then(response => response.json())
            .then(schema => {
                const session = enigma.create({
                    schema,
                    // Change the url to point to your QIX instance
                    url: 'ws://localhost:4848/app/engineData',
                    createSocket: url => new WebSocket(url)
                });
                session.open()
                    .then(global =>
                        global.openDoc("adf.qvf")
                            .then(app => {
                                app.createMeasure(
                                    {
                                    "Name":"haha",    
                                    "qInfo": {
                                        "qId": "IIII001",
                                        "qType": "measure"
                                    },
                                    "qMeasure": {
                                        "qLabel": "Sum of hahaha gddolf11 course holes",
                                        "qDef": "=sum(1)"
                                    },
                                    "qMetaDef": {
                                        "title": "Sum of golf cddou11rse holes"
                                    }
                                }
                                ).then(measure => {
                                    measure.getLayout().then((layout)=>console.log(layout));
                                })
                           
                                   // .then(() => session.close())

                            })


                    )
            })
    </script>
   

</head>

</html>
1 Reply
J_Lindberg
Support
Support

Hello @yuhuangli 

It appears that this question has ended up in the wrong forum. In this forum we're able to help you with Qlik Application Automation related questions. Qlik Application Automation provides a no-code visual interface that helps you easily build automated analytics and data workflows. 
It would be great if you could post this question in the forum related to the product you are using.
Qlik Sense forum: https://community.qlik.com/t5/Qlik-Sense/ct-p/qlik-sense