Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Update multiple master measures in go using Engine API

Hi,

I have a mashup application wherein in need to update the formulae of multiple measures or dimensions in one go.

Let's suppose I have two master measures having IDs x1 and x2 having formula as below:

x1: Field1 + Field2

x2: FIeld1 + Field3

I need to replace Field1 with Field4 in both the measures.

The steps I am following to update the measure using Engine API are as follows:

1. CreateSessionObject

2. GetLayout

3. GetMeasure

4. GetProperties

5. SetProperties

6. DestroySessionObject

7. SaveChanges

I am using a loop to iterate through these IDs and calling these methods in sequence.

But the problem is that it updates the first Measure and not the subsequent one (receiving error: "{"jsonrpc":"2.0","id":0,"error":{"code":-32602,"parameter":"Invalid handle","message":"Invalid Params"}}").

I couldn't figure out what is causing the issue.

Any help would be greatly appreciated.

Regards,

Pradeep

1 Reply
ErikWetterberg

Hi,

Looks like you use fixed values for handle in your commands, you probably need to parse the replies to find the actual handle, which will probably be different for the second measure.

I don't know your context, but another possibility is to use a variable in your expressions, and simply change the variable value.

Hope this helps

Erik Wetterberg