You need to sign in to do that
Don't have an account?
Selecting records where a datetime value meets criteria
Hi there,
I have a querry in my apex trigger that looks like this:
List<DatedConversionRate> ExchRateCache = [SELECT ISOCode, ConversionRate, StartDate, NextStartDate FROM DatedConversionRate where ISOCode in :CurrCodes ];
This works fine, but it pulls the currency exchange rate of all time, and I only want the exchange rate on the 1st day of the month. I then changed it as below.
List<DatedConversionRate> ExchRateCache = [SELECT ISOCode, ConversionRate, StartDate, NextStartDate FROM DatedConversionRate where ISOCode in :CurrCodes AND ExchRateCache.StartDate.Day()='1'];
But I got an error saying "unexpected token: ')' at line 70 column 192"
Can some one be so kind and give me some instruction? Very much appreciate!
Alice
Try This
List<DatedConversionRate> ExchRateCache = [SELECT ISOCode, ConversionRate, StartDate, NextStartDate FROM DatedConversionRate where DAY_IN_MONTH(StartDate) = 1 and ISOCode in :CurrCodes ];
All Answers
Try this
List<DatedConversionRate> ExchRateCache = [SELECT ISOCode, ConversionRate, StartDate, NextStartDate FROM DatedConversionRate where StartDate.Day()='1' and ISOCode in :CurrCodes ];
Hi Andy,
Thanks for the response! It's still showing "Error: Compile Error: unexpected token: ')' at line 70 column 148" .
Try This
List<DatedConversionRate> ExchRateCache = [SELECT ISOCode, ConversionRate, StartDate, NextStartDate FROM DatedConversionRate where DAY_IN_MONTH(StartDate) = 1 and ISOCode in :CurrCodes ];
Please add in kudos if work fine.