- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2016 01:32 AM
How to write a complex query�
now,I have a query as follows。
select tbl.a,
tbl b,
tbl c
from table tbl
where 1=1
and (a.start_date >= '2015-04-01' and a.start_date <= '2016-03-31') or (a.end_date >= '2015-04-01' and a.end_date <= '2016-03-31')
var tableInfo = new GlideRecord('x_smei_table');
.........................?
.........................?
.........................?
.........................?
.........................?
.........................?
.........................?
tableInfo .query();
How to implement this query? help~~� help~~!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2016 06:53 PM
The problem was solved.
var tableInfo = new GlideRecord("x_smei_table");
var startDate = new GlideDateTime();
startDate.setDisplayValueInternal(strStarDate + " 00:00:00");
var endDate = new GlideDateTime();
endDate.setDisplayValueInternal(strEndDate + " 23:59:59");
var dateQuery = "ent_start_dateBETWEEN" + startDate + "@" + endDate + "^ORent_end_dateBETWEEN" + startDate + "@" + endDate;
tableInfo .addEncodedQuery(dateQuery);
tableInfo.query();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2016 06:56 PM
Thank you for your patience. thank you....

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2016 07:26 PM
It has something to do with Application Scoping. gs.dateGenerate() must only be accessible from Global scope. Try and generate a different query that doesn't use that function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2016 06:53 PM
The problem was solved.
var tableInfo = new GlideRecord("x_smei_table");
var startDate = new GlideDateTime();
startDate.setDisplayValueInternal(strStarDate + " 00:00:00");
var endDate = new GlideDateTime();
endDate.setDisplayValueInternal(strEndDate + " 23:59:59");
var dateQuery = "ent_start_dateBETWEEN" + startDate + "@" + endDate + "^ORent_end_dateBETWEEN" + startDate + "@" + endDate;
tableInfo .addEncodedQuery(dateQuery);
tableInfo.query();