Focal Point
[SOLVED] FOCUS to SQL conversion issue

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/2357081276

August 14, 2014, 02:57 PM
Rao D
[SOLVED] FOCUS to SQL conversion issue
I have a condition similar to
WHERE (COUNTRY IN ('ENGLAND','ITALY')) OR (COUNTRY IN ('USA','INDIA'));
when passed to database it is converted into

COUNTRY IN ('ENGLAND','ITALY','USA','INDIA') but I want it to be like

COUNTRY IN ('ENGLAND','ITALY') OR COUNTRY IN ('USA','INDIA') when using AND instead of OR I am seeing it is converted in the correct way i.e

WHERE (COUNTRY IN ('ENGLAND','ITALY')) AND (COUNTRY IN ('USA','INDIA')); to
COUNTRY IN ('ENGLAND','ITALY') AND COUNTRY IN ('USA','INDIA')

Is there a way to convert the FOCUS OR condition in the same lines as in AND. We are using Oracle as the DB.

Thanks for any help!

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS - ver8201
[ReportingServers: Windows 64bit;
Client: tomcat and IIS on windows 2012
AppStudio

August 14, 2014, 03:02 PM
j.gross
as long as it returns the correct result without degrading performance, what does it matter?
August 14, 2014, 03:20 PM
Rao D
The issue is I have a HOLDFILE which contains order numbers and depending on the execution criteria the number of order numbers in the HOLDFILE may be less than or greater than 1000 rows.
This HOLDFILE is used in the where clause of another TABLE request using IN FILE HOLDFILE when records in the HOLDFILE are more than 1000 the SQL is failing as Oracle limits 1000 values in the where clause condition.

Using dialogue manager commands I have separated the records more than 1000 and want to put them in the OR condition instead of all in single flow like

COUNTRY IN ('ENGLAND','ITALY') OR COUNTRY IN ('USA','INDIA').

Because FOCUS to SQL conversion is putting everything as COUNTRY IN ('ENGLAND','ITALY','USA','INDIA') I had to replace the entire section of the FOCUS code with SQL PASS THRU where the OR condition remains as is. If the conversion works as needed then I can use the FOCUS code back in place instead of SQL PASS THRU.


WebFOCUS - ver8201
[ReportingServers: Windows 64bit;
Client: tomcat and IIS on windows 2012
AppStudio

August 14, 2014, 04:46 PM
j.gross
This works, in 7.6.10:
TABLE FILE mytable
LIST *
WHERE (mykey IN FILE 'LIST1' AND 1 EQ 1)
   OR (mykey IN FILE 'LIST2' AND 1 NE 2);
END


Explanation:
"1 eq 1" evaluates to True;
"[assertion1] and True" is equivalent to just "[assertion1]"

But WF is not sufficiently intelligent or presumptuous to delete "and 1 eq 1" / "and 1 ne 2", so it generates

where (mykey in (first,list,of,values) and 1 = 1) or (mykey in (second,list,of,values) and 1 <> 2)


- Jack Gross
WF through 8.1.05
August 15, 2014, 12:14 PM
Rao D
Hi Jack,

Thanks for the suggestion! Adding 'AND 1 = 1' in the first list itself worked and no need for additional conditions.

Thanks again!


WebFOCUS - ver8201
[ReportingServers: Windows 64bit;
Client: tomcat and IIS on windows 2012
AppStudio