Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
DIM_ProductBatchMaster:
LOAD
UPPER(PROD_BATCH) AS [Product Batch Code],
Fact_Type AS [Fact Type Code],
Fact_Type_Desc AS [Fact Type],
LocCode AS [Batch Location Code],
Loc_name AS [Batch Location],
Date(floor(MDATE),'DD/MM/YYYY') AS [Manufacturing Date],
Date(floor(EDATE),'DD/MM/YYYY') AS [Expiry Date],
Date(floor(EFFDATE),'DD/MM/YYYY') AS [Effective Date],
If(num(num(Date(floor(Max(EDATE))))-num(Date('$(vDateForAgeing)')))>=1 and num(num(Date(floor(Max(EDATE))))-num(Date('$(vDateForAgeing)')))<=30,'1-30',
if(num(num(Date(floor(Max(EDATE))))-num(Date('$(vDateForAgeing)')))>=31 and num(num(Date(floor(Max(EDATE))))-num(Date('$(vDateForAgeing)')))<=60,'31-60',
if(num(num(Date(floor(Max(EDATE))))-num(Date('$(vDateForAgeing)')))>=61 and num(num(Date(floor(Max(EDATE))))-num(Date('$(vDateForAgeing)')))<=90,'61-90',
if(num(num(Date(floor(Max(EDATE))))-num(Date('$(vDateForAgeing)')))>=91 and num(num(Date(floor(Max(EDATE))))-num(Date('$(vDateForAgeing)')))<=180,'91-180',
if(num(num(Date(floor(Max(EDATE))))-num(Date('$(vDateForAgeing)')))>=181,'181+',
if(num(num(Date(floor(Max(EDATE))))-num(Date('$(vDateForAgeing)')))<1 ,'Expired',
if(IsNull(date(Max(EDATE))) OR Date(Max(EDATE))='','Date NA'))))))) AS InvDaysSelection
FROM
[Source QVDs SIM\DIM_ProductBatchMaster.qvd]
(qvd);
I have the above code but whenever i relaod the script it shows general script error please help me out..
Thanks and Regards,
Rohit Yadav
Hii
Max function works with resident and group by
so, you have to put your if condition in resident load
like
A:
load a,b,c from A;
New:
load
max(a) as Q,
b,c
resident A
Group by b,c;
hope it helps
If(num(Date(floor(EDATE)))-num(Date('=IF(ISNULL(GetFieldSelections(MonthName))=0 OR ISNULL(GetFieldSelections(FinancialYear))=0,DATE(MAX([Posting Date])),DATE(Today())) '))>=1 and num(Date(floor(EDATE)))-num(Date('=IF(ISNULL(GetFieldSelections(MonthName))=0 OR ISNULL(GetFieldSelections(FinancialYear))=0,DATE(MAX([Posting Date])),DATE(Today())) '))<=30,'1-30',
if(num(Date(floor(EDATE)))-num(Date('=IF(ISNULL(GetFieldSelections(MonthName))=0 OR ISNULL(GetFieldSelections(FinancialYear))=0,DATE(MAX([Posting Date])),DATE(Today())) ')))>=31 and num(num(Date(floor(EDATE))-num(Date('=IF(ISNULL(GetFieldSelections(MonthName))=0 OR ISNULL(GetFieldSelections(FinancialYear))=0,DATE(MAX([Posting Date])),DATE(Today())) ')))<=60,'31-60',
if(num(Date(floor(EDATE)))-num(Date('=IF(ISNULL(GetFieldSelections(MonthName))=0 OR ISNULL(GetFieldSelections(FinancialYear))=0,DATE(MAX([Posting Date])),DATE(Today())) '))>=61 and num(Date(floor(EDATE)))-num(Date('=IF(ISNULL(GetFieldSelections(MonthName))=0 OR ISNULL(GetFieldSelections(FinancialYear))=0,DATE(MAX([Posting Date])),DATE(Today())) '))<=90,'61-90',
if(num(Date(floor(EDATE)))-num(Date('=IF(ISNULL(GetFieldSelections(MonthName))=0 OR ISNULL(GetFieldSelections(FinancialYear))=0,DATE(MAX([Posting Date])),DATE(Today())) '))>=91 and num(Date(floor(EDATE)))-num(Date('=IF(ISNULL(GetFieldSelections(MonthName))=0 OR ISNULL(GetFieldSelections(FinancialYear))=0,DATE(MAX([Posting Date])),DATE(Today())) '))<=180,'91-180',
if(num(Date(floor(EDATE)))-num(Date('=IF(ISNULL(GetFieldSelections(MonthName))=0 OR ISNULL(GetFieldSelections(FinancialYear))=0,DATE(MAX([Posting Date])),DATE(Today())) '))>=181,'181+',
if(num(Date(floor(EDATE)))-num(Date('=IF(ISNULL(GetFieldSelections(MonthName))=0 OR ISNULL(GetFieldSelections(FinancialYear))=0,DATE(MAX([Posting Date])),DATE(Today())) '))<1 ,'Expired',
if(IsNull(date(EDATE)) OR Date(EDATE)='','Date NA')))))))
This is the code with expanded variable...I removed max fuction but now it shows if takes 2-3 parameters...