Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
smilingjohn
Specialist
Specialist

Where

Hi All,

Iam using the below condition in the script  using where condition ..

Where (Pass_Year= Year(Today()) and Passmonth <= 12) AND (Pass_Year = Year(Today())-1 and Passmonth > 12);

This is giving me error..Please let me know if this is correct or needs to be changed ..

Thanks

10 Replies
tamilarasu
Champion
Champion

Hi John,

The where clause looks fine. What is the error message?

smilingjohn
Specialist
Specialist
Author

Hi Nagaraj

Thanks for the reply ..when I reload this I get a error like

Unexpected expression  error ')..

Iam confused with this

ali_hijazi
Partner - Master II
Partner - Master II

Pass_Year cannot be at the same time Year(Today()) and Year(Today())-1

your condition should be

Where (Pass_Year= Year(Today()) and Passmonth <= 12) OR (Pass_Year = Year(Today())-1 and Passmonth > 12);


One thing to note the Month cannot be greater than 12!!

I can walk on water when it freezes
vineetadahiya12
Contributor III
Contributor III

This condition seems working fine when I tried with some dummy data. Can you share you sample that would make it easy to debug .

vineetadahiya12
Contributor III
Contributor III

The condition is fine seems the issue is in some other part of script

tamilarasu
Champion
Champion

Hi John,

I think the issue is not because of the where condition but some other part. Could you please post your script here.

smilingjohn
Specialist
Specialist
Author

HI Nagaraj.

My full where condition is below

where (Pass_year = Year(Today()) and passmonth <= 12) or (Pass_year = Year(Today())-1 and passmonth > 12)

and [Discription_Date] < if(WeekDay(today()) = 'Fri',today() - 3,     

                       if(WeekDay(today()) = 'Sun', today() - 2, 

                          today() - 1)); 

and the error is like missing field '<= > 

tamilarasu
Champion
Champion

John,

The above where condition is also looks fine to me . It looks like you have problem in passmonth field. Can you please check your passmonth field? Also If possible please share complete load statement.?

Anil_Babu_Samineni

I believe you need this?

where ((Pass_year = Year(Today()) and passmonth <= 12) or (Pass_year = Year(Today())-1 and passmonth > 12))

and ([Discription_Date] < if(WeekDay(today()) = 'Fri',today() - 3, if(WeekDay(today()) = 'Sun', today() - 2, today() - 1)));

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful