0

I'm about to begin implementing a new version of an Email marketing program for my company. The old version of the program program heavily depended on micros and has about 2000 lines to prepare data for an email campaign to be run. But I have read somewhere that macros are not the best solution to run such heavy tasks and it's better we keep them for simple things.

I'm quite new to QV and I'm the kind of person that likes to learn as I go and not complete a big reference book before I start a project. I'm good at C# and Java but I realized QlikView scripts are in either VBScript or JScript. I have no experience with them whatsoever but they don't look very complicated to me at first glance.

What I was wondering was whether there is a better way of handling data in QlikView? That means can I use another programming language or do you suggest I stick to the script languages provided by QV? Because one big problem I've seen is that as macros get larger they become very hard to debug.

In the old version of our program developed by one of my colleagues who has now left the company, as soon as there was an error in preparing the data, all we got was the macros window with no clue about where the error had taken place. As I would like to implement this project incrementally and little by little, I would like to have a good mechanism for trouble shooting rather than goring though a 2000-line script to understand where the problem comes from.

Your suggestions about how to bring this project to a safe shore are very welcome. So, any good plugins or 3rd party app to monitor the data and facilitate my implementation can help.

disasterkid
  • 6,948
  • 25
  • 94
  • 179

1 Answers1

1

We are an outlier there. We are using the OCX and connect to it in winforms.

We have then standard c# code with everything debuggable and it makes everyone here very happy indead after using endless amount of time debugging javascripts.

The users use QV for selecting stuff and then we use the selected event in the OCX and pull the selected data from QV for postprocessing and tag the QV data with dynamic sql update.

I do not nessesarily recommend this method, but it has increased dramatically the development output for us when using QV for datamining and then processing the data selected.

Next project we are not going to use the OCX. But all the buisness logic and postprocessing is in a com visible c# dll' that we access through vbscript macro.

EDIT. More details

This is the current setup communicating with the document through OCX

Change a selection

axQlikMainApp.ActiveDocument.Fields("%UnitID").Clear();
var selSuccess = axQlikMainApp.ActiveDocument.Fields(cls.QlikView.QvEvalStr.Fields.UnitId).Select("(%UnitID)");

reset a sheet object

 axQlikMainApp.ActiveDocument.ClearCache();
 axQlikMainApp.ActiveDocument.GetSheetObject("Document\\MySheetObjectName").Restore();

get a string from QV

string res axQlikMainApp.ActiveDocument.Evaluate("=concat(Distinct myField1 &'|' & MyField2,'*')");

and can get horribly complicated

    string res axQlikMainApp.ActiveDocument.Evaluate( "=MaxString({1 <%UnitID= {" + sUnitIds + @"}>}'<b>' & UnitName & '</b> \r\n bla bla bla:' & UnitNotesPlanning) & " + 
"'\n title1: ' & Count({1 <%UnitID= {" + sUnitIds +@"},%ISODate={'" + qlickViewIsoDate + "'},Need = {'Ja'}" + MinusCalc + ">}Distinct %CivicRegNo) & " + 
"'\n Title2: '  & Count({1 <%UnitID= {" + sUnitIds + @"},%ISODate={'" + qlickViewIsoDate + "'} " + recallMinusCalc + ">}DISTINCT RevGUID) & " +
"'\n Title3: '  & Count({1 <%UnitID= {" + sUnitIds + @"},%ISODate={'" + qlickViewIsoDate + "'},Need2 = {'Ja'}>}Distinct %CivicRegNo) & '" +
"\n Title4:'     & MinString({1 <%UnitID= {" + sUnitIds + @"},FutureBooking = {1}>} Date(BookingStart) & ' Beh: ' & If(IsNull(ResourceDisplayedName),'_',ResourceDisplayedName)) &'" +
"\n Title5:'   & MaxString({1 <%UnitID= {" + sUnitIds + @"},FutureBooking = {0}>} Date(BookingStart) & ' Beh: ' & If(IsNull(ResourceDisplayedName),'_',ResourceDisplayedName)) &''" +
" & MaxString({1 <%UnitID= {" + sUnitIds + @"}>}if(UnitGeo_isRelocatedOnSameGeo=1,'\nOBS! Multiple geo addresses. Zoom!',''))" +
""
);
Archlight
  • 2,019
  • 2
  • 21
  • 34
  • can you please elaborate just a little more on that. Does that mean and you have a dll somewhere from which you invoke the functions you need from QlikView. Let's say you need to convert a table object into text and save that text file somewhere. How do you tell QV to invoke a specific function from a DLL file. It would be great if you could show me via a screen shot or two how it's done. Or bring a small example of one of your functions. I don't want my program to rely on VBScript. So it's good that you have a working solution like that. Can you tell me a little more about that? – disasterkid Jan 13 '14 at 14:46
  • 1
    Added a few details. The code is c# in winforms with an ocx called axQlikMainApp – Archlight Jan 13 '14 at 19:46
  • so what you have is a DLL file that resides somewhere other than the QV file and when any event triggers on the DV file this file is notifies and does the required actions? – disasterkid Jan 14 '14 at 15:53
  • thats the way we are going to do the next project, but the examples I've shown you are for the winforms / OCX thing – Archlight Jan 15 '14 at 06:46