Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
The table CrossSales_Status_Result is missing after creating it in do while loop. I want to create a table referencing it in [Customer_List_Existing] after exiting the loop.
Set a=0;
LET vCount = NoOfRows('Customer_List');
Do while a< $(vCount);
(....)
NoConcatenate
CS_Temp10:
Load *,
Customer_Code & '_' & MonthYear as CrossSales_Key,
Customer_Code & '_' & MonthYear as Customer_Key;
Load Customer_Code,
MonthYear,
CrossSales_Status,
Date(Date#(CrossSales_Date, 'YYYYMMDD'), 'D/M/YYYY') as CrossSales_Date;
Resident CS_Temp9;
Drop Table CS_Temp9;
CrossSales_Status_Result:
Load *,
Cross_Cate & '_' & CrossSales_Key as CrossSales_Key_v2;
Load Distinct Customer_Code,
CrossSales_Date,
CrossSales_Key,
Replace(Replace(Replace(Replace(CrossSales_Status,'+Promotion',''), '+promotion', ''), '->Promotion', ''), '->promotion','') as CrossSales_Status,
SubField(CrossSales_Status , '->', 2) as Cross_Cate
Resident CS_Temp10
where NOT ISNULL(CrossSales_Status);
Drop Table CS_Temp10;
CS_Temp11:
Load Distinct CrossSales_Date
Resident CrossSales_Status_Result;
Join (CS_Temp11)
CS_Temp12:
Load Distinct CrossSales_Status
Resident CrossSales_Status_Result;
Concatenate (CrossSales_Status_Result)
ALSKDLS:
Load CrossSales_Date,
CrossSales_Status,
1 & '_' & date(MonthEnd(CrossSales_Date), 'MMM-YYYY') as CrossSales_Key,
1 as Customer_Code
Resident CS_Temp11;
(...)
Let a=a+1;
Loop
Customer_List_Existing:
Load Customer_Code as Cust_ID
Resident CrossSales_Status_Result;
You write that not even your inline gets generated.
Are you sure that you ever get into the loop? Do you have rows in your Customer_List table?
Try printing out some validation figures before running the loop by adding the bold section in script snipplet below. Just to check that
Are you sure that it is missing? or is it just not containing the data that you expect?
You have some (...) are they manipulating the `CrossSales_Status_Result` table in any way. If so it could be that you don't get your expected autoconcatenate of `CrossSales_Status_Result` to work as expected in the beginning of your loop.
Steps to troubleshoot.
- Try to add an exit script after the loop to see what's in your datamodel
- Try to add an exit script at the end of the loop. The script stops at the end of first iteration. Check what tables and fields that are in your datamodel.
hi, (...) is used to replace paragraphs of script.
Anyways, I added the following inline table in the loop (random table just for testing) and exit script after the loop, and the table is missing.
Table:
LOAD * Inline [
ID , brand , criteria , assesement
123 , abc , Q9, Y
145 , abc , Q9, Y
123 , abc , P11, Y
145 , abc , P11, N
];
I then tried adding exit script between "Let a=a+1;" and "Loop" and also after "Loop". [Table] is still missing from data model.
This is the entire segment:
You write that not even your inline gets generated.
Are you sure that you ever get into the loop? Do you have rows in your Customer_List table?
Try printing out some validation figures before running the loop by adding the bold section in script snipplet below. Just to check that
yes, Customer_List is indeed empty! i was stuck on this for so long thinking the answer was from inside the loop. you're brilliant!
Thanks for the feedback. 👍 Glad I could help. 😊