我正在尝试在加载内联语句中使用变量值,而不是在获取变量公式的奇怪子字符串时加载变量值。
我做错了什么?
因此TEMPTABLE是从文件中加载的,它显示每月数据,我需要将该数据显示为每日数据,因此我将值除以该月中的天数,然后将其加载到“最终”表中
Set vNoOfRows = NoOfRows('TEMPTABLE');
FOR i=0 to $(vNoOfRows)
SET vYear=Peek('Year',$(i),'TEMPTABLE');
SET vMonthName=Peek('MonthName',$(i),'TEMPTABLE');
SET vCOMPANYNAME=Peek('COMPANYNAME',$(i),'TEMPTABLE');
SET vTYPE_BUSINESS=Peek('TYPE_BUSINESS',$(i),'TEMPTABLE');
SET vSUB_PRODUCT=Peek('SUB_PRODUCT',$(i),'TEMPTABLE');
SET vRENEWAL=Peek('RENEWAL',$(i),'TEMPTABLE');
SET vDaysincurrentmonth=Peek('DaysInMonth',$(i),'TEMPTABLE');
SET vDayCount=Peek('Daycount',$(i),'TEMPTABLE');
SET vPolicies_Day=Peek('Policies_Day',$(i),'TEMPTABLE');
SET vUWP_Day=Peek('UWP_Day',$(i),'TEMPTABLE');
SET vGWP_IPT_Day=Peek('GWP-IPT_Day',$(i),'TEMPTABLE');
SET vClaims_Day=Peek('Claims_Day',$(i),'TEMPTABLE');
SET vIncurred_Day=Peek('Incurred_Day',$(i),'TEMPTABLE');
Set a=1;
Do while a<=$(vDaysincurrentmonth)
FINAL:
LOAD * INLINE [
Year,MonthName,Day,COMPANYNAME,TYPE_BUSINESS,SUB_PRODUCT,RENEWAL,Policies_Day,UWP_Day,GWP_IPT_Day,Claims_Day,Incurred_Day
=$(vYear),=$(vMonthName),=$(a),=$(vCOMPANYNAME),=$(vTYPE_BUSINESS),=$(vSUB_PRODUCT),=$(vRENEWAL),=$(vPolicies_Day),=$(vUWP_Day),=$(vGWP_IPT_Day),=$(vClaims_Day),=$(vIncurred_Day)
];
Let a=$(a)+1;
Loop
NEXT i
DROP TABLE TEMPTABLE;
答案 0 :(得分:1)
脚本中的变量的行为与表达式侧的行为不同。在脚本中,它们更像是“用当前值替换此变量”,而不是实际的变量求值。
也就是说,不要使用等号(不需要),并确保所有非数字变量都包含在'中。例如:
$(vYear),'$(vMonthName)',$(a),'$(vCOMPANYNAME)'
这应该使您朝着正确的方向前进。