用于访问数据对象的宏的替代方法 [英] Alternatives to macros for accessing data objects

查看:86
本文介绍了用于访问数据对象的宏的替代方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将开始为我的公司实施新版本的电子邮件营销计划.该程序程序的旧版本在很大程度上依赖于micros,并具有大约2000行以准备要运行的电子邮件活动的数据.但是我在某个地方读取了宏并不是执行繁重任务的最佳解决方案,最好让它们用于简单的事情.

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.

我对QV还是很陌生,是那种喜欢随便学的人,在开始一个项目之前没有完成一本大的参考书.我擅长C#和Java,但我意识到QlikView脚本位于VBScript或JScript中.我对他们一无所知,但是乍一看,它们看起来并不复杂.

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.

我想知道的是QlikView中是否有更好的数据处理方式?这意味着我可以使用其他编程语言,还是建议我坚持QV提供的脚本语言?因为我看到的一个大问题是,随着宏的变大,它们变得很难调试.

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.

在我的一个同事(他已经离开公司)开发的程序的旧版本中,一旦准备数据出现错误,我们得到的只是宏窗口,不知道错误在哪里发生在.由于我想逐步实现这个项目,所以我希望有一个很好的机制来解决问题,而不是花2000行脚本来了解问题的出处.

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.

推荐答案

我们在那里是一个离群值.我们正在使用OCX并以Winforms形式连接到它.

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

然后,我们有了标准的c#代码,所有内容均可调试,在使用了无穷无尽的时间调试javascript后,这使每个人都感到非常高兴.

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.

用户使用QV选择内容,然后在OCX中使用所选事件,并从QV中提取所选数据进行后处理,并使用动态sql更新标记QV数据.

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.

我不必要地推荐这种方法,但是当使用QV进行数据挖掘然后处理所选数据时,它为我们大大增加了开发输出.

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.

下一个项目,我们将不使用OCX.但是所有的商务逻辑和后处理都在我们通过vbscript宏访问的com可见的c#dll中.

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.

编辑.更多详情

这是通过OCX与文档进行通信的当前设置

This is the current setup communicating with the document through OCX

更改选择

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

重置工作表对象

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

从QV获取字符串

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

并且可能变得非常复杂

    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!',''))" +
""
);

这篇关于用于访问数据对象的宏的替代方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆