Hi Every One,
I wanted to Store my CSV File after checking the If condition.
at first I try to find the Date and count(id) as countid1 for 2 Months ago and then I try to find the Data for last Mount and its Count(id) as countid2.
like this:
test2:
load
count(id) as countid1,
// Peek(count(id)) as countid2,
month(datum) & '_'& year(datum) as Month_years
Resident Datei
where month(datum)<= Month(AddMonths(Today(),-2))
and month(datum) > Month(AddMonths(Today(),-3))
and Year(datum) =Year(AddMonths(Today(),-1))
group by month(datum) ,year(datum);
test3:
load
count(id) as countid2,
month(datum)&'_'& year(datum) as Month_years
Resident Datei
where month(datum)<= Month(AddMonths(Today(),-1))
and month(datum) > Month(AddMonths(Today(),-2))
and Year(datum) =Year(AddMonths(Today(),-1))
group by month(datum) , year(datum);
now I want to save my CSV data but at first I should check if the difference between 2Months ago and one Month ago less than or equal 2 is and if yes then Store my Data
I had try this:
set vResualt2=countid1-countid2;
if $(vResualt2) <=2 then
STORE [Datei] INTO ....... (delimiter is ';');
end If
without if Condition it works but I need at first Check and then Store it.
Is there anyone who could Help me PLease
set vResualt2=countid1-countid2;
you need to peek the values of countid1 and countid2 and store each of those peeks as their own variable (my preference)
let vCountId1 = peek('countid1',0,'test2')
let vCountId2 = peek('countid2',0,'test3')
set vResualt2 = $(vCountId1) - $(vCountId2)
then :
if $(vResualt2) <=2 then
STORE [Datei] INTO ....... (delimiter is ';');
end If
May be you need to use 'Peek' while you are referencing data table fields countid1 and id2.
LET countid1 = peek('countid1');
LET countid2= dpeek('countid2');
set vResualt2=countid1-countid2;
Thanks a lot 🙂