Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Getting a General Script Error on a simple RESIDENT Load. This is the first time I've tried RESIDENT Loading so I anticipate I may have a simple syntactical issue here, unfortunately the Log file provides no useful info on the error other than stating its a General Script Error and Debugger doesn't seem to provide any additional info on the problem either
Here is my LOAD statement:
NET30DELTA:
LOAD
(SUM(AVERAGE_DELTA)/COUNT(AVERAGE_DELTA)) AS AVGGROWTH
RESIDENT DISC_USAGE
WHERE DISC_DATE >= AddMonths(MAX(DISC_DATE),-1)
;
Using an aggregation function in the where clause is most likely the problem.
WHERE DISC_DATE >= AddMonths(MAX(DISC_DATE),-1)
You can try using a variable instead:
Temp:
load Max(DISC_DATE) as MaxDiscDate
from ...disc_usage_source...;
LET vMaxDD = addmonths(peek('MaxDiscDate'),-1);
drop table Temp;
LOAD
(SUM(AVERAGE_DELTA)/COUNT(AVERAGE_DELTA)) AS AVGGROWTH
RESIDENT DISC_USAGE
WHERE DISC_DATE >= $(vMaxDD);
Hi Lew
is not an error in a table resident,
you're doing grouping operations(sum, Count) without a GROUP BY
for any field
example month
NET30DELTA:
LOAD
(SUM(AVERAGE_DELTA)/COUNT(AVERAGE_DELTA)) AS AVGGROWTH ,
Month,
RESIDENT DISC_USAGE
WHERE DISC_DATE >= AddMonths(MAX(DISC_DATE),-1)
Group by Month;
Hello Manuel,
Thanks for your reply. I have applied your recomendation and added another column to use for Grouping, yet I still get the failure. Here is what I see in the Log.
1/29/2013 1:33:34 PM: 0148 NET30_DELTA:
1/29/2013 1:33:34 PM: 0149 LOAD
1/29/2013 1:33:34 PM: 0150 SRC_SYS_CD,
1/29/2013 1:33:34 PM: 0151 (SUM(AVERAGE_DELTA)/COUNT(AVERAGE_DELTA)) AS AVG_GROWTH30
1/29/2013 1:33:34 PM: 0152 RESIDENT DISC_USAGE
1/29/2013 1:33:34 PM: 0153 WHERE DISC_DATE >= AddMonths(MAX(DISC_DATE),-1)
1/29/2013 1:33:34 PM: 0154 Group By SRC_SYS_CD
1/29/2013 1:33:34 PM: General Script Error
1/29/2013 1:33:34 PM: Execution Failed
Using an aggregation function in the where clause is most likely the problem.
WHERE DISC_DATE >= AddMonths(MAX(DISC_DATE),-1)
You can try using a variable instead:
Temp:
load Max(DISC_DATE) as MaxDiscDate
from ...disc_usage_source...;
LET vMaxDD = addmonths(peek('MaxDiscDate'),-1);
drop table Temp;
LOAD
(SUM(AVERAGE_DELTA)/COUNT(AVERAGE_DELTA)) AS AVGGROWTH
RESIDENT DISC_USAGE
WHERE DISC_DATE >= $(vMaxDD);
Hi Gysbert,
I commend your QV Skills...that seems to have done the trick! Thanks for your assistance, I'm not so sure I would have figured this one out on my own.
Best Regards,
Lew