Page 1 of 1

TI code for identifying unique new elements

Posted: Wed Sep 07, 2011 4:42 pm
by rvanlierop
I am trying to import a text file that contains multiple instances of Purchase order numbers. Before adding these to an existing dimension I want to create a text file that will show unique instances of the PO numbers that are not currently in the dimension. This file contains data that is not filtered for PO.

Re: TI code for identifying unique new elements

Posted: Wed Sep 07, 2011 5:05 pm
by lotsaram
1. Compare the PO number to the current PO dimension with DIMIX
2. If the PO does not currently exist insert it into a temporary dimension
3. Export the temporary dimension to a text file
3. Destroy the temporary dimension

Re: TI code for identifying unique new elements

Posted: Wed Sep 07, 2011 7:10 pm
by jim wood
Or you can create a holding cube. Store them comma delimited in the cube for reference. (Do this by checking if there is a value already there. If not just store the PO number. If there is read the current value, append a comma then the new PO number.) If you do this based on the date that it ran. (Add the date to a date dimension in the holding cube.) you can keep an easily accesable record of new PO numbers and when they hit.

Re: TI code for identifying unique new elements

Posted: Thu Sep 08, 2011 4:26 pm
by rvanlierop
jim wood wrote:Or you can create a holding cube. Store them comma delimited in the cube for reference. (Do this by checking if there is a value already there. If not just store the PO number. If there is read the current value, append a comma then the new PO number.) If you do this based on the date that it ran. (Add the date to a date dimension in the holding cube.) you can keep an easily accesable record of new PO numbers and when they hit.
Just to be sure I understand are you saying create a cube with a numbered dimension 1-10,000 and another dimension for holding PO number and import date?

Re: TI code for identifying unique new elements

Posted: Thu Sep 08, 2011 6:02 pm
by jim wood
Apologies if I was a little vague.

Create a cube that has 2 dimensions: 1) Date. Just add one date to this. 2) A measure dimension that contains a text element.

In your dimension update process if you get a new element firstly insert the date in to the date dimension. Use Today(1) (Keeps the year to 2 digits) and dimension element insert for this. Also insert the data in a comma delimited format. The formula for this would look something like this:

Code: Select all

IF(CellGetS('New Element Deposit',Today(1),'text') @= ''
    ,DimensionElementInsert('Deposit Date', 1, Today(1),'S')
    ,''
   ) ;

IF(CellGetS('New Element Deposit',Today(1),'text') @= ''
    ,CellPutS(element_variable,'New Element Deposit',Today(1),'text')
    ,CellPutS(CellGetS('New Element Deposit',Today(1),'text')|','|element_variable,'New Element Deposit',Today(1),'text')
   ) ;
I hope that helps,

Jim.