Skip to main content
added 156 characters in body
Source Link
SfdcBat
  • 4.8k
  • 28
  • 105
  • 213

Below is my sample data:

enter image description here

I am trying to form a query where I can get records within a date range.

Date Range is start of the week to end of the week. For example I want all records that falls between July 10th - July 16 AND July 24 to July 30.

What I tried is having all the startweek in a Set<Date> setOfStartWeek and endWeek in Set<Date> setOfendWeek. Used below query :

List<Record> recList = [Select Id,Name,StartDate from Record where StartDate >= :setOfStartWeek AND StartDate <= :setOfEndWeek];

Desired Result => return records between July 10th - July 16 i.e records 1,2 AND return records between July 24 to July 30 i.e record 5,6.

The volume of the records is low = 3600 The date range can be dynamic, and not in my control. I can get setOfStartWeekDates that has July 10,24,31.. max it could contain 12 weeks from first element i.e. July 10 - Sept 25.

An approach but not sure if it would work

I will have a Set setOfdates = {July 10,24,31}. A formula field on the record that give me the start week date like July 10, July 24. Can I use in my SQOL- Where startWeekDate In: setOfStartWeeks , however I this doesn't seem to be working for me. Can we not use a set for Date field in where clause ? like how we do it : Id in :setOfIds ?

Below is my sample data:

enter image description here

I am trying to form a query where I can get records within a date range.

Date Range is start of the week to end of the week. For example I want all records that falls between July 10th - July 16 AND July 24 to July 30.

What I tried is having all the startweek in a Set<Date> setOfStartWeek and endWeek in Set<Date> setOfendWeek. Used below query :

List<Record> recList = [Select Id,Name,StartDate from Record where StartDate >= :setOfStartWeek AND StartDate <= :setOfEndWeek];

Desired Result => return records between July 10th - July 16 i.e records 1,2 AND return records between July 24 to July 30 i.e record 5,6.

The volume of the records is low = 3600 The date range can be dynamic, and not in my control. I can get setOfStartWeekDates that has July 10,24,31.. max it could contain 12 weeks from first element i.e. July 10 - Sept 25.

Below is my sample data:

enter image description here

I am trying to form a query where I can get records within a date range.

Date Range is start of the week to end of the week. For example I want all records that falls between July 10th - July 16 AND July 24 to July 30.

What I tried is having all the startweek in a Set<Date> setOfStartWeek and endWeek in Set<Date> setOfendWeek. Used below query :

List<Record> recList = [Select Id,Name,StartDate from Record where StartDate >= :setOfStartWeek AND StartDate <= :setOfEndWeek];

Desired Result => return records between July 10th - July 16 i.e records 1,2 AND return records between July 24 to July 30 i.e record 5,6.

The volume of the records is low = 3600 The date range can be dynamic, and not in my control. I can get setOfStartWeekDates that has July 10,24,31.. max it could contain 12 weeks from first element i.e. July 10 - Sept 25.

An approach but not sure if it would work

I will have a Set setOfdates = {July 10,24,31}. A formula field on the record that give me the start week date like July 10, July 24. Can I use in my SQOL- Where startWeekDate In: setOfStartWeeks , however I this doesn't seem to be working for me. Can we not use a set for Date field in where clause ? like how we do it : Id in :setOfIds ?

added 156 characters in body
Source Link
SfdcBat
  • 4.8k
  • 28
  • 105
  • 213

Below is my sample data:

enter image description here

I am trying to form a query where I can get records within a date range.

Date Range is start of the week to end of the week. For example I want all records that falls between July 10th - July 16 AND July 24 to July 30.

What I tried is having all the startweek in a Set<Date> setOfStartWeek and endWeek in Set<Date> setOfendWeek. Used below query :

List<Record> recList = [Select Id,Name,StartDate from Record where StartDate >= :setOfStartWeek AND StartDate <= :setOfEndWeek];

Desired Result => return records between July 10th - July 16 i.e records 1,2 AND return records between July 24 to July 30 i.e record 5,6.

It didThe volume of the records is low = 3600 The date range can be dynamic, and not return any resultsin my control. Is there a way to do this? Thanks!!I can get setOfStartWeekDates that has July 10,24,31.. max it could contain 12 weeks from first element i.e. July 10 - Sept 25.

Below is my sample data:

enter image description here

I am trying to form a query where I can get records within a date range.

Date Range is start of the week to end of the week. For example I want all records that falls between July 10th - July 16 AND July 24 to July 30.

What I tried is having all the startweek in a Set<Date> setOfStartWeek and endWeek in Set<Date> setOfendWeek. Used below query :

List<Record> recList = [Select Id,Name,StartDate from Record where StartDate >= :setOfStartWeek AND StartDate <= :setOfEndWeek];

Desired Result => return records between July 10th - July 16 i.e records 1,2 AND return records between July 24 to July 30 i.e record 5,6.

It did not return any results. Is there a way to do this? Thanks!!

Below is my sample data:

enter image description here

I am trying to form a query where I can get records within a date range.

Date Range is start of the week to end of the week. For example I want all records that falls between July 10th - July 16 AND July 24 to July 30.

What I tried is having all the startweek in a Set<Date> setOfStartWeek and endWeek in Set<Date> setOfendWeek. Used below query :

List<Record> recList = [Select Id,Name,StartDate from Record where StartDate >= :setOfStartWeek AND StartDate <= :setOfEndWeek];

Desired Result => return records between July 10th - July 16 i.e records 1,2 AND return records between July 24 to July 30 i.e record 5,6.

The volume of the records is low = 3600 The date range can be dynamic, and not in my control. I can get setOfStartWeekDates that has July 10,24,31.. max it could contain 12 weeks from first element i.e. July 10 - Sept 25.

added 143 characters in body
Source Link
SfdcBat
  • 4.8k
  • 28
  • 105
  • 213

Below is my sample data:

enter image description here

I am trying to form a query where I can get records within a date range.

Date Range is start of the week to end of the week. For example I want all records that falls between July 10th - July 16 AND July 24 to July 30.

What I tried is having all the startweek in a Set<Date> setOfStartWeek and endWeek in Set<Date> setOfendWeek. Used below query :

List<Record> recList = [Select Id,Name,StartDate from Record where StartDate >= :setOfStartWeek AND StartDate <= :setOfEndWeek];

Desired Result => return records between July 10th - July 16 i.e records 1,2 AND return records between July 24 to July 30 i.e record 5,6.

It did not return any results. Is there a way to do this? Thanks!!

Below is my sample data:

enter image description here

I am trying to form a query where I can get records within a date range.

Date Range is start of the week to end of the week. For example I want all records that falls between July 10th - July 16 AND July 24 to July 30.

What I tried is having all the startweek in a Set<Date> setOfStartWeek and endWeek in Set<Date> setOfendWeek. Used below query :

List<Record> recList = [Select Id,Name,StartDate from Record where StartDate >= :setOfStartWeek AND StartDate <= :setOfEndWeek];

It did not return any results. Is there a way to do this? Thanks!!

Below is my sample data:

enter image description here

I am trying to form a query where I can get records within a date range.

Date Range is start of the week to end of the week. For example I want all records that falls between July 10th - July 16 AND July 24 to July 30.

What I tried is having all the startweek in a Set<Date> setOfStartWeek and endWeek in Set<Date> setOfendWeek. Used below query :

List<Record> recList = [Select Id,Name,StartDate from Record where StartDate >= :setOfStartWeek AND StartDate <= :setOfEndWeek];

Desired Result => return records between July 10th - July 16 i.e records 1,2 AND return records between July 24 to July 30 i.e record 5,6.

It did not return any results. Is there a way to do this? Thanks!!

Source Link
SfdcBat
  • 4.8k
  • 28
  • 105
  • 213
Loading