Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikView forum consolidation is complete. Labels are now required. LEARN ABOUT LABELS
cancel
Showing results for 
Search instead for 
Did you mean: 
girish_talele
Creator
Creator

Use Macro Function in Expression

Dear Experts,

I am new to Qlik View,

I have created a simple macro function as given below

Function ZMultiply(ZQty)

    ZMultiply = ZQty * 10

End Function

I tried to use this function in Expression (refer attached qvw) but failed to do so.

My query is - Can we use Macro Function in Expression if yes How?

Thanks in Advance,

Girish.

1 Solution

Accepted Solutions
colin_albert

If you use macros, be aware that this will reduce performance as the cache will be cleared, and the expressions will be executed in a less optimised method.

There are more details of this in this thread - read the attached document "Understanding the Impact of Macros" in the thread.   Plz Forward the Qlikview Macros & Triggers ... | Qlik Community

View solution in original post

5 Replies
colin_albert

If you are new to QlikView, then ignore macros. They are not required for the majority of applications.

Most tasks can be done directly using expressions and actions without the need for macros.

Learn how to apply the power of the associative data model, QlikView expressions and load scripts.

jagan
MVP & Luminary
MVP & Luminary

Hi,

Instead of macro try like this

Create a variable like this

variable Name = Calc

Expression -  Num(($1)) * 10 (Note : don't give = in variable declaration)

Now use this in expression like this

=$(Calc (65))

The above returns 650 i.e., 65 * 10

Regards,

Jagan.

datanibbler
Champion
Champion

Hi Colin,

I'm absolutely with you there.

Macros are for "emergencies" - things that you absolutely cannot do with QlikView_internal functionality - or for the real experts who want to do some wondrous thing.

In one year of developing QlikView apps, I have come across one instance where we needed a macro - something QlikView should actually do by itself via document_triggers, but those don't work reliably in Ajax.

Best regards,

DataNibbler

girish_talele
Creator
Creator

Dear Colin & DataNibbler,

Thanks for looking into.

Certainly QlikView is a very good tool & it’s functions are also suffice the requirements. But in our case, there are some long expressions/formulas which we need to use extensively.

For such cases, earlier in excel we have developed UDFs (VBA) for the same. And to ease the things (instead of writing long formula) in QlikView expression, we want to use macro UDFs here also .

Dear Jagan,

Thanks for variable we will see if complicated formulas can be accommodate in variables.

Regards,

Girish

colin_albert

If you use macros, be aware that this will reduce performance as the cache will be cleared, and the expressions will be executed in a less optimised method.

There are more details of this in this thread - read the attached document "Understanding the Impact of Macros" in the thread.   Plz Forward the Qlikview Macros & Triggers ... | Qlik Community

View solution in original post