Buy Support
Incidents |
If you can't find your answer
in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us
private or confidential information: |
Click Here
|
If you can't
login and post questions or you are having trouble viewing forum posts:
Click Here
|
Callback
Support |
If you live in USA, UK, Canada, Australia or New
Zealand, you can leave us details on your question and request us to call you back and discuss
them with you personally (charges apply). |
Click Here
|
Buy Support
Incidents |
If you can't find your answer
in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us
private or confidential information: |
Click Here
|
|
Are there IF/IIF/CASE and/or REPLACE functions in QODBC? |
Author |
Message |
|
Posted : 2006-08-26 09:25:20 |
Hello,
I'm wondering if there are IF/IIF/CASE functions or REPLACE functions for QODBC? The reasons for the respective functions are below:
- I would like to build a SELECT statement where if the value is one thing, do a, if it's another, do b. This is normally done as an Iif statement (in Access) or a CASE statement (in SQL). For instance:
SELECT Name, Address1, IF(Gender = 'F', 'Pink', 'Blue') AS ClothingColor FROM Customers SELECT CASE Gender WHEN 'F' THEN 'Pink' WHEN 'M' THEN 'Blue' END FROM CUSTOMERS
- I would like to replace a character in a string with another one. For instance, if I have a placeholder character in a string, such as "~", I may want to replace it with a blank, and then TRIM it:
Assume that Codeword = "COMMIKKMENK"
SELECT Replace(CodeWord, 'K', 'T') FROM Codewords
Result would be "COMMITTMENT".
Are either of these two functionalities available with the QODBC driver? If not, are they planned? Thanks! |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-08-26 10:12:07 |
The use of
CASE sql_expression WHEN sql_expression_value THEN return_value ELSE return_value
or
CASE WHEN sql_Boolean_expression THEN return_value ELSE return_value
is currently not supported by QODBC, but it's on the wish list!
All the QODBC Functions can be found by clicking here. |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-09-06 12:25:12 |
The REPLACE function can be done in MS Access using VBA functions like this:
DoCmd.RunSQL _ "INSERT INTO Local_ItemInventory ( Part, Description, QuantityOnHand ) " & _ "SELECT Name, replace(PurchaseDesc,chr(10),chr(13) & chr(10)), QuantityOnHand " & _ "FROM ItemInventory " & _ "WHERE IsActive=Yes"
and QODBC does support the REPLACE function directly too:
{fn replace(sql_string_to_search, sql_string_to_find, sql_string_to_replace_with)}
For example:
SELECT Name, {fn REPLACE("Name", 'i', 'xxxxxx')} AS "Replaced" FROM Customer
|
|
|
|
|
Posted : 2006-09-06 14:43:55 |
Thanks... I actually am not having trouble doing it in Access, but since Excel's query logic is very limited, in order to use dynamic PivotTables in Excel, I need to be able to get the data in the correct format directly out of QODBC (via SQL queries). As an alternative, I have tried DTS'ing the QODBC data to MSDE (SQL) first, THEN pulling it into Excel from SQL, but the DTS imports take an inordinate amount of time to complete (over an hour for just the SAMPLE data file, and a few tables)!! Does anyone know what could be causing a DTS import from QODBC to take so long? |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-09-07 08:25:45 |
Environments like MS SQL Server are multi-threading, while the QuickBooks session is per thread, so we have to restart a new QuickBooks session every time the MS SQL Server thread ID changes. This slows processes like DTS extremely as most of the time you are waiting for QuickBooks to restart. |
|
|
|
|