Updating Attributes using TI and ODBCoutput
Posted: Wed Jun 17, 2009 9:35 pm
Our Accountants update/change accounts all the time and I am trying to find the best way to update the Account (add attributes such as account name) in TM1 when we load data from Oracle.
During my Load Actuals for the current month process, I am trying to create a way where If the account does not exist then it is created (done in the metadata section using DIMIX and DimensionElementInsert) then I would like to query Oracle to return the Account attributes and use the AttrPutS() function to update the account names.
From my understanding I have to create the account in the Metadata tab but in the Data Tab I would then alter the Attribute?
So here is what I hope will work...
Metadata TAB
# Check to see if the Seg3 Consoidation exists #
IF(DIMIX('IS Accounts',SEG3)=0);
# If Not... Make a Seg3 Consolidation #
DimensionElementInsert('IS Accounts', '', SEG3, 'C');
# And Add it to the Orphaned Accounts Consolidation #
DimensionElementComponentAdd('IS Accounts', 'Orphaned Accounts', SEG3, 1);
# Then Add the new account to the New SEG3 Consolidation in the Orphaned Accounts #
DimensionElementInsert('IS Accounts','', GL_ACCOUNT,'n');
DimensionElementComponentAdd('IS Accounts', SEG3, GL_ACCOUNT,1);
# if the Segment3 exists place the new account in the Seg3 consolidation
ELSEIF(DIMIX('IS Accounts',SEG3) <>0);
DimensionElementInsert('IS Accounts','',GL_ACCOUNT,'n');
DimensionElementComponentAdd('IS Accounts', SEG3, GL_ACCOUNT,1);
ENDIF;
And then in the Data Tab I would get the Attribute name from Oracle..
DATA TAB
IF(DIMIX('IS Accounts', GL_ACCOUNT)=0);
ODBCOpen('DataSource','username','password');
variableAccountName = ODBCOutput('DataSource','select account_name from accounts where account = '%GL_ACCOUNT%'');
AttrPutS(variableAccountName,'IS Accounts',GL_ACCOUNT,'AccountName');
ODBCClose('DataSource');
ENDIF;
Can this work? Do I have to create a variable in the Metadata tab that will hold the current new account and then the Data Tab will see the variable?
Please Help.
~Kevin Beckley
Portland, OR
During my Load Actuals for the current month process, I am trying to create a way where If the account does not exist then it is created (done in the metadata section using DIMIX and DimensionElementInsert) then I would like to query Oracle to return the Account attributes and use the AttrPutS() function to update the account names.
From my understanding I have to create the account in the Metadata tab but in the Data Tab I would then alter the Attribute?
So here is what I hope will work...
Metadata TAB
# Check to see if the Seg3 Consoidation exists #
IF(DIMIX('IS Accounts',SEG3)=0);
# If Not... Make a Seg3 Consolidation #
DimensionElementInsert('IS Accounts', '', SEG3, 'C');
# And Add it to the Orphaned Accounts Consolidation #
DimensionElementComponentAdd('IS Accounts', 'Orphaned Accounts', SEG3, 1);
# Then Add the new account to the New SEG3 Consolidation in the Orphaned Accounts #
DimensionElementInsert('IS Accounts','', GL_ACCOUNT,'n');
DimensionElementComponentAdd('IS Accounts', SEG3, GL_ACCOUNT,1);
# if the Segment3 exists place the new account in the Seg3 consolidation
ELSEIF(DIMIX('IS Accounts',SEG3) <>0);
DimensionElementInsert('IS Accounts','',GL_ACCOUNT,'n');
DimensionElementComponentAdd('IS Accounts', SEG3, GL_ACCOUNT,1);
ENDIF;
And then in the Data Tab I would get the Attribute name from Oracle..
DATA TAB
IF(DIMIX('IS Accounts', GL_ACCOUNT)=0);
ODBCOpen('DataSource','username','password');
variableAccountName = ODBCOutput('DataSource','select account_name from accounts where account = '%GL_ACCOUNT%'');
AttrPutS(variableAccountName,'IS Accounts',GL_ACCOUNT,'AccountName');
ODBCClose('DataSource');
ENDIF;
Can this work? Do I have to create a variable in the Metadata tab that will hold the current new account and then the Data Tab will see the variable?
Please Help.
~Kevin Beckley
Portland, OR