Page 1 of 1
How to sum up two variable values and bring in to one elemen
Posted: Tue Jul 29, 2014 7:02 pm
by dharav
Hello All
I would like to know that how could we sum up two variables and bring that value in to third element.
If we have sourceview than we could write
Nvalue=(CellGetN(Value, cube name, V1,'ABC',V3,V4)+(CellGetN(Value, cube name,v1,'cde',v3,v4));
If (V2@=klm);
CellputN=(NValue, cubename,v1,'klm',v3,v4);
I have text file from which i have to SUM UP the data of ABC and CDE. The obtained sum value i have to upload in to KLM.
How could i do it? (Same as above just source would be different - Instead of source view now it is text file as a data source)
Thanks
Dharav
Re: How to sum up two variable values and bring in to one el
Posted: Tue Jul 29, 2014 7:22 pm
by declanr
If it is 2 columns in your text file you just add the 2 variables together.
If the value is in 1 column and the variable is derived by another column then you can just use CellIncrementN or a CellPutN with a nested CellGetN on the same cell to achieve the same result (dependent on version.)
Personally though I would probably just create the 2 variables as measures and then have a third measure that is the consolidation of the 2.
Re: How to sum up two variable values and bring in to one el
Posted: Tue Jul 29, 2014 8:51 pm
by dharav
Hello Declanr
declanr wrote:If it is 2 columns in your text file you just add the 2 variables together.
If the value is in 1 column and the variable is derived by another column then you can just use CellIncrementN or a CellPutN with a nested CellGetN on the same cell to achieve the same result (dependent on version.)
Personally though I would probably just create the 2 variables as measures and then have a third measure that is the consolidation of the 2.
Even i would like to go through with your personal approach in generic situation. Here I have ABC Metro in target cube which would get the sum of Metro ABC and DEF from source cube.
I have data in text file, so how could i write CellGetN as there is no cube to target. Source of data is text file.
I thought to include 2 elements in metro dimension outside the hierarchy and get the data in to this element normally and than
write nvalue=((CellGetN(,,,'ABC',))+(CellGetN(,,,'DEF',)));
IF V4@='ABC';
CellputN(nvalue,,,'ABC',)
Do you have other efficient thought than let me know? I would definitely try the CellincreamentN and update you
Thanks
Dharav Patel
Re: How to sum up two variable values and bring in to one el
Posted: Tue Jul 29, 2014 9:07 pm
by declanr
So the variables in question aren't measures -
Variable | Value |
ABC | 1000 |
DEF | 220 |
You can use:
Code: Select all
If ( ( vVariable @= 'ABC' ) % ( vVariable @= 'DEF' ) );
CellPutN ( Value + CellGetN ( sCube, v1, v2, 'KLM' ), sCube, v1, v2, 'KLM' );
EndIf;
Or the CellPutN/CellGetN combo can be replaced with CellIncrementN. That is what I meant by nesting a CellGetN.
Just make sure to clear the destination before starting the load.
Edit - and if you have a lot of these mappings you can create a dimension with what all the elements are in the source file, each having an attribute of what element they map to in the destination cube then just reference that in your incremental load.
Re: How to sum up two variable values and bring in to one el
Posted: Wed Jul 30, 2014 4:20 pm
by dharav
Thank You Declanr
I did same. I create a small consolidation in to source with new element 123 where leaves are those two elements which should be combined with their amounts. I sent that 123 in to file and from other instance in TI process i replace 123 with target.
I would also try your other recommendation. Thanks for your time and input.
Re: How to sum up two variable values and bring in to one el
Posted: Wed Jul 30, 2014 9:34 pm
by dharav
Declanr
In data tab,
i have one if condition statement. Now when i am writing another if condition statement than it throws the error. I wrote same if statement with new TI (everything same as before without earlier if statement) than it worked as expected. I am writing seconf if statement for cellIncrementN TI function so i can not combine in earlier if statement.
Is there a way where, Data tab executes both IF statements and in the order. First if statement should execute first and second if statement should execute second and more important both if statement should get executed.
Thanks
Dharav Patel
Re: How to sum up two variable values and bring in to one el
Posted: Thu Jul 31, 2014 3:35 am
by declanr
dharav wrote:Declanr
In data tab,
i have one if condition statement. Now when i am writing another if condition statement than it throws the error. I wrote same if statement with new TI (everything same as before without earlier if statement) than it worked as expected. I am writing seconf if statement for cellIncrementN TI function so i can not combine in earlier if statement.
Is there a way where, Data tab executes both IF statements and in the order. First if statement should execute first and second if statement should execute second and more important both if statement should get executed.
Thanks
Dharav Patel
Multiple IF statements work fine. Can you post the code that didn't work and the error message?
Re: How to sum up two variable values and bring in to one el
Posted: Fri Aug 01, 2014 12:09 pm
by dharav
Declanr
Thank You. It works. I had to set up one element before another in data source