MS ACCESS OUTPUT – Note that it created the table based on parameters below
Prolog
# ODBC datasource called ‘tm1output’ DSN='tm1output';
UName='';
Pass='';
#Open DB
ODBCOpen(DSN,UName,Pass);
#Create table
ODBCOutput(DSN, 'Create table af ( Plan TEXT, Versions TEXT, FY TEXT, ALC TEXT, GLAC TEXT, vMeasures TEXT, val_num TEXT)' );
NOTE THAT THE OPEN AND CREATE THE TABLE WORKED.
Data
ODBCOutPut('tm1output', ('INSERT INTO af ( [Plan], [Versions], [FY], [ALC], [GLAC], [vMeasures], [val_num]) VALUES ( "%V1%", "%V2%", “%V3%", "%V4%", "%V5%", “%V6%â€, %val_num% )' ) );
I get an error each time with the Insert into command – "Baseline","Plan","ALC","FY 09","MSD STD","Cost of Operations CY","550.",Data Source line (1) Error: Data procedure line (14): Error executing SQL query: "INSERT INTO af ( [Plan], [Versions], [FY], [ALC], [GLAC], [vMeasures], [val_num]) VALUES ( "%V1%", "%V2%", “%V3%", "%V4%", "%V5%", “%V6%â€, %val_num% )"
It must be user error, any thoughts, suggestions? Thanks
ODBCOutPut Command - MS Access 2007
-
- Posts: 1
- Joined: Mon Mar 08, 2010 4:46 pm
- OLAP Product: TM1
- Version: 9.4 - 9.5
- Excel Version: 2007
- Steve Rowe
- Site Admin
- Posts: 2456
- Joined: Wed May 14, 2008 4:25 pm
- OLAP Product: TM1
- Version: TM1 v6,v7,v8,v9,v10,v11+PAW
- Excel Version: Nearly all of them
Re: ODBCOutPut Command - MS Access 2007
Hi weimerskirch ,
Welcome to the forum! I think you are missing the Expand command from your statement. This will convert the %variables% into what you really want.
Welcome to the forum! I think you are missing the Expand command from your statement. This will convert the %variables% into what you really want.
HTHExpand
This is a TM1 TurboIntegrator function, valid only in TurboIntegrator processes.
This function "expands" TurboIntegrator variable names, enclosed in % signs, to their values at run time. If the variable name represents a string variable, the entire variable expression must be enclosed on quotes. For example, "%V1%".
A common use of the Expand function is to pass the value of TurboIntegrator variables to the ODBCOutput function. Refer to the example below for details.
Syntax
Expand(String);
Argument
String Any string that includes TurboIntegrator variable names enclosed in % signs.
Example
ODBCOutPut( 'TransData', Expand( 'INSERT INTO SALES ( MONTH, PRODUCT, SALES ) VALUES ( "%V0%", "%V1%",%V2% )' ) );
This example illustrates the use of the Expand function within the ODBCOutput function. The example inserts records into a relational table named Sales that consists of three columns: Month, Product, and Sales.
The Expand function converts the variables V0, V1, and V2 to their actual values within the view. Assuming that the first value in the view is 123.456, and is defined by the elements Jan and Widget
Expand( 'INSERT INTO SALES ( MONTH, PRODUCT, SALES ) VALUES ( "%V0%", "%V1%",%V2% )' )
becomes
'INSERTINTO SALES ( MONTH, PRODUCT, SALES ) VALUES ( Jan, Widget, 123.456 )'
at run time.
Technical Director
www.infocat.co.uk
www.infocat.co.uk
-
- MVP
- Posts: 214
- Joined: Tue Nov 11, 2008 11:57 pm
- OLAP Product: TM1, CX
- Version: TM1 7x 8x 9x 10x CX 9.5 10.1
- Excel Version: XP 2003 2007 2010
- Location: Hungary
Re: ODBCOutPut Command - MS Access 2007
Hello,
This works for me:
sSQL=EXPAND('INSERT INTO %sTable% (year, month, cn,cc, value) VALUES (%year1%,%sPeriod%,%cost_number%,%cost_center%,%sValue%)');
Could you try it without "" signs?
And try to use the EXPAND() function. You can read about it in the reference guide.
Regards,
Peter
This works for me:
sSQL=EXPAND('INSERT INTO %sTable% (year, month, cn,cc, value) VALUES (%year1%,%sPeriod%,%cost_number%,%cost_center%,%sValue%)');
Could you try it without "" signs?
And try to use the EXPAND() function. You can read about it in the reference guide.
Regards,
Peter
Best Regards,
Peter
Peter