HPQC ALM : what is the format for Date field in REST based query - alm

I am trying to use REST call to HP QC ALM12. It works so far but hit a problem when trying to query based on a Date field. Wondering what's the correct syntax to specify a Date query. For example, for the field 'creation-time', how do I filter result within a period ? I have tried these but got HTTP 500 error:
{creation-time[>= '2015-01-01' AND <= '2015-06-01']}
{creation-time[>= '2015-01-01T00:00:00.000Z']
thanks for any help.

figured out the correct syntax, it is:
field_name[>=yyyy-MM-dd AND <=yyyy-MM-dd]
not quoted.

Related

VBF syntax for SSRS expression cannot figure out proper construct

looking for help on what should be a very basic function. I am trying to get a SUM of a specific value, however I do not seem to get the syntax correct.
Here is what I have
=Sum(Fields!PriorYearSalesDollars.Value - Sum(Fields!PriorYearCost.Value
+Sum(Fields!PriorYearFrtCost.Value)))
However I get an error when trying to sum. Is there another way to test this also? Each time I modify the expression I then have to save the report and upload to the report server and test again. If I do it through the preview function in visual studio it throws a generic error on the whole report. When running from report server, just this specific column shows #Error
This is the syntax that works after FIRST changing the column format to numbers where I accidentally did it as currency first. Not sure why currency didn't work, but this is correct.
=Sum(Fields!PriorYearSalesDollars.Value) - (Sum(Fields!PriorYearCost.Value) + Sum(Fields!PriorYearFrtCost.Value))

Node.js - Oracle DB and fetchAsString format

I am stuck on a problem and I am not sure what is the best way to solve it. I have a date column that I want to select and I want to fetch it as a string. Which is great, node-oracledb module has this option with fetchAsString mehotd. But it fetches the date like this for example 10-JAN-16 and I want to fetch it like this 10-01-2016. Is there a way to do that from the node-oracledb module, or I should modify the date after I get the result from the query?
UPDATE: I mean solution without to_char in the query and without query modifications
Check out this section of my series on Working with Dates in JavaScript, JSON, and Oracle Database:
https://dzone.com/articles/working-with-dates-using-the-nodejs-driver
The logon trigger shows an example of using alter session to set the default date format. Keep in mind that there is NLS_DATE_FORMAT, NLS_TIMESTAMP_FORMAT, NLS_TIMESTAMP_TZ_FORMAT.
I only show NLS_TIMESTAMP_TZ_FORMAT because I convert to that type in the examples that follow as I need to do some time zone conversion for the date format I'm using.
Another way to set the NLS parameters is to use environment variables of the same name. Note that this method will not work unless you set the NLS_LANG environment variable as well.

querysting binding error when using ServiceStack version 4.0.34 and OrmLiteCacheClient

We're getting an "unable to bind to request" when calling a service with the following querystring:
/SomeService?playerid=59326&fromdate=4-1-2014&todate=12-11-2014
We have been using this querysting format for awhile now.
The problem is some either a change in 4.0.34, or something in the OrmLightCacheClient, which we had turned off for awhile and only just recently turned it back on.
If I change the dates to following format, it seems to work.
/SomeService?playerid=59326&fromdate=2014-4-1&todate=2014-12-31.
We can roll with the changed querystring date format for now, but wanted to report the error.
When supplying a date only (i.e. doesn't include a time) it should be unambiguously defined using the YYYY-MM-DD format.

Search formula not working on Linux machine

I have a strange behavior: an agent called via an AJAX request should search documents to display in a calendar. For that reason I compute a search formula and then run the search method of my database in Lotusscript. This is the formula:
form="mholiday" | form="mserviceevent" | (form="mereignis" & co_status!="9") & #texttotime(#text(startdatetime)) >= [29.09.2014] & #texttotime(#text(enddatetime)) =< [10.11.2014]
Everything's fine on Domino on Windows but fails with "formula error" on a Linux machine. Am I missing something?
If I omit the term with the dates everything is fine, so this is the part that causes the error.
Try it with #ToTime() and #Date() instead. That might help to get away from local settings' influence on server:
... & #ToTime(startdatetime) >= #Date(2014; 9; 29) & ...
#ToTime() doesn't convert the field if it's a date time value already.
#Date doesn't depend on local settings whereas [29.09.2014] probably does.
I don't think it's a Linux problem, I think it's a data problem. It sounds like either a date format problem or a problem with the UNK table, used by full text search.
If the first document created on that server that had a field called "startdatetime" had a text value, then any search expects "startdatetime" to be a text value, even if there is another field in the database called startdatetime that is a date or the startdatetime field is subsequently changed to be a date. To confirm this, you can use the search bar and select the field. The operators it offers will confirm if it's expecting a date or a text value. See this answer for details on how to resolve "Query is not understandable" - Full text searching where field types have changed.
Alternatively, it may be a problem with the date format, as Knut says. In which case a test for 9/9/2014 would work but 29/9/2014 wouldn't.

How do I filter a SQL query by exact match to string?

I'm using MS SQL 2008 and I have a status field that comes like this:
"REF CNF PCNF REL"
I need to get all the orders with status CNF without returning PCNF.
I could do it using spaces before and after WHERE STATUS LIKE '% CNF %', but if CNF is the first or last status it wouldn't work.
One solution that worked was:
WHERE
PATINDEX('CNF %',STATUS)=0 AND
PATINDEX('% CNF %',STATUS)=0 AND
PATINDEX('% CNF',STATUS)=0
But that is just horrible.
Thanks,
As said by Marc B., you should normalize your table to avoid storing more than one value in a single field.
If you don't have the credentials to do that, or if you want to keep your model as it is, you can try to add spaces before and after your string:
WHERE ' '+STATUS+' ' LIKE '% CNF %'
This way you don't have to worry about CNF being first or last item in your list.
I don't know if it's the most elegant/effective solution, but it works.
Why not simply
WHERE STATUS LIKE '% CNF%' OR STATUS LIKE 'CNF%'
?
The wildcard % matches any character(s), also none.
Using SQL 2008's own internal functions, the best I can think of is getting it down to just two conditions like:
where STATUS like 'CNF%' or STATUS like '%[^P]CNF%'
But if you were willing to install a .Net add-on, you could use regular expressions like so:
where 1 = dbo.RegExpLike(STATUS, '(CNF| CNF)')

Resources