Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, June 20, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Failed to parse SQL - Complex SQL statements
Paul VanderWaal
Posts: 23
 
Failed to parse SQL - Complex SQL statementsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 31 Aug 07 11:14 AM
Is there a way to get a complex SQL statement to run in v7 ? They used to run no problem in 5.2 and prior, and when I moved to 6.2 I got them to work using DAO and ODBC as a workaround, but in version 7 I using SLX_DB recordsets get the same Failed to parse SQL error I got in 6.2. And when I attempt to use the 6.2 workaround using DAO in 7, I get a .dll error.

Here is a sample SQL statement which used to run in 5.2 but fails now...

strsql = "If (Select TYPE from CONTACT where CONTACTID = 'CK2VD0000813') = 'Test' Select LASTNAME as LNAME from CONTACT where CONTACTID = 'CK2VD0000813' Else Select '(unknown)' as LNAME"

This was my workaround code that works in 6.2 but not 7...

Const dbUseODBC = 1
Const dbDriverNoPrompt = 1
Const dbOpenDynaset = 2
Dim DBEngine As Object
Dim wrk As Object
Dim cnn As Object
Dim rst As Object

Set DBEngine = CreateObject("DAO.DBEngine.36")
Set wrk = DBEngine.CreateWorkspace("NewODBCDirect", "sa", "", dbUseODBC) 'Create the workspace
Set cnn = wrk.OpenConnection("SLX", dbDriverNoPrompt, False, "ODBC;DSN=SalesLogix Production;UID=sysdbaWD=masterkey;DATABASE=SalesLogix") ' Open connection.
Set rst = cnn.OpenRecordset(strSQL, dbOpenDynaset) ' Open recordset on connection.


Any ideas on how to get this to run in 7?

Thank you.
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Failed to parse SQL - Complex SQL statementsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 31 Aug 07 11:58 AM
How about rewriting your SQL statement:

SELECT CASE WHEN TYPE = 'Test' THEN LASTNAME ELSE '(unknown)' END AS LNAME FROM CONTACT WHERE CONTACTID = 'CK2VD0000813'

Same result, simpler syntax and it will run in SLX
[Reply][Quote]
Paul VanderWaal
Posts: 23
 
Re: Failed to parse SQL - Complex SQL statementsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Sep 07 6:32 AM
This did work, thank you.
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 6/20/2025 7:17:52 AM