Hi All,

 

I'm in the process of converting a Macro from MSO to OOo.

 

The macro reads a series of SQL queries which are written in File 1, and
applies each of them against Data in File2.  Both File1 and File2 are
OpenOffice Calc Document (initially XL Workbooks).

 

The macro is nearly completed by I currently hit a road block, which I don't
know how to solve.

 

Queries like this works perfectly.

 

1.   Select RowNo, PT_NAME, EPISODE_ID, DCN, START_TIME from QcSheet Where
(Total_Minutes < 51)

2.  Select RowNo, PT_NAME, EPISODE_ID, DCN, START_TIME from QcSheet Where
(Total_Minutes <= 140 and Total_Minutes >= 25)

 

 

But the following Queries are behaving erratically.

 

1.  Select RowNo, PT_NAME, EPISODE_ID, DCN, ('type is missing please check')
as Condition_16 from QCSheet Where ATYPE='S' and TOS='A'  

      -  The 5th column (Condtion_16) contains nothing / "" for all the
rows.  If I try with double quotes (") instead of single quote (').  I get
an Error.

 

2.  Select Left(BATCH_CODE,5) from QcSheet group by Left(BATCH_CODE,5)

      -  This queries returns first five chars of All the Rows.  It does not
groups by the Left(BATCH_CODE,5).  Other group by queries also behave in the
same way.

 

 

When I try to test these queries in OOBase. The syntaxes are different. like
double quotes for all table and column names and single quotes for Text.  If
I follow the same pattern in OOCalc, I get the error.

 

Do we have any guidelines available for such SQL Queries ?   Why are the
queries expected differently between Calc and Base.

 

Please help.

 

Incase if anybody is curious about the code I used, here it is.

 

----------------------------------------------------------------------------
------------------------------------------------

Function DoSql(sql$) as object

            dim oManager

            dim oCon

            dim oStatement

            dim sSql

            dim oResult

 

            oManager = CreateUnoService("com.sun.star.sdbc.DriverManager")

            oCon = oManager.getConnection("sdbc:calc:" & datasourcefile)

            oStatement = oCon.CreateStatement()

 

            sSql = sql

            

            

            oResult = oStatement.executeQuery(sSQL)

 

            DoSql = oResult

            

End Function

----------------------------------------------------------------------------
------------------------------------------------

 

- Raja

 


Disclaimer:-

  This e-mail transmission may contain proprietary,confidential or legally
  privileged information (including encrypted Individually Identifiable
  Health Information) that is intended only for the individual(s) or
  entity(ies) named in the email address. If you are not the intended
  recipient please notify the sender and destroy this email and any
  attachments immediately. Any unauthorized use or distribution of this
  message in whole or in part is strictly prohibited.

  Eco friendly practice - THINK BEFORE YOU PRINT: before printing this
  email think whether it is really necessary.
   GreenTree (Reduce. Reuse. Recycle.)

Reply via email to