The following script works find if I hard code the variable results but not if I use the variable names. Any clues or suggestions?
#vSql = 'INSERT INTO
The element, data etc muck is only when you're using the TI wizard, which is evil. It's not relevant to your issue, but the question does suggest an answer.rfielden wrote:Newbie question #67: I am trying to extract Applix cube data into an Oracle table to find another application. I have created a view of the cube that I use as the Data Source and the Variable listing comes up correct. Any special way the variables should be defined? Do I need to tag as element, data, etc. and complete associated tabs?
Which tab are you doing this on? From the sounds of it it may be the Prolog, which would explain why it works with hard coded values but not otherwise. Remember that variables have no value in the Prolog tab. They only acquire a value when the process loops through the data source in the Metadata and/or Data tab. (If the data source has been processed via one of those two tabs the variables retain the last value read in the Epilog tab, but persontally I regard it as bad practice to use data source variables in that tab... and it's pointless to use them in the Prolog tab.)rfielden wrote:The following script works find if I hard code the variable results but not if I use the variable names. Any clues or suggestions?
TM1 Reference Guide > TM1 TurboIntegrator Functions > Miscellaneous TurboIntegrator Functions > Expand
--------------------------------------------------------------------------------
Expand
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.
Code: Select all
ODBCOutPut( 'appstst', Expand( 'INSERT INTO ak_rfiel.applix_test ( Years,Periods,BeStates,BeMeasures,MValue )' | ' VALUES (''%Years%'',''%Periods%'',''%BeStates%'',''%BeMeasures%'',%Value%)'));