cancel
Showing results for 
Search instead for 
Did you mean: 

Asking for dimension member A value and take Dimension member B value based on A. SCRIPT LOGIC

former_member182305
Active Participant
0 Kudos

Hello experts,

I have a question related Scripto logic. I have been reading that to ask for a dimension member value, you need to use Ternary expression. A>B ? C : D.

Lets say I have the dimensions Category, Account, Time, Entity, Currency, Worker, Company Code and SUPNOM.

SUPNOM has let´s say 2 members:Salary and Company. Company makes reference to Company Code.

The ratio of Company its for the user to capture the company code for the worker it could change, is very changable so could not be an attribute of the dimension worker.

My question is the next.

How to check the company code based on the %value% and then take the Salary value,

i.e.

*When SUPNOM

*IS Company

*REC (EXPRESSION= %VALUE%==1000? (HERE i wanto to set the value contained in Salary, not the 1000), 0

How to take the value I want instead of the value 1000?

Thanks for the posts.

Best Regares.

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor

Sample of slow script:

*XDIM_MEMBERSET COMPANY=COMP_NONE
*XDIM_MEMBERSET SUPNOM=Salary
*WHEN COMPANY
*IS *
*REC(EXPRESSION=([SUPNOM].[Company]==1000) ? %VALUE% : 0, COMPANY=1000)
*REC(EXPRESSION=([SUPNOM].[Company]==1100) ? %VALUE% : 0, COMPANY=1100)
*REC(EXPRESSION=([SUPNOM].[Company]==1200) ? %VALUE% : 0, COMPANY=1200)
... //for all possible companies
*ENDWHEN

each line will check the current record...

former_member182305
Active Participant
0 Kudos

Vadim,

Thank you very much for the code, one last question about the anwer. Is it possible to make it this way?

XDIM_MEMBERSET COMPANY= A
*WHEN SUPNOM 
*IS Company
*REC(EXPRESSION=(%Value%==1000) ?[SUPNOM].[Salary] : 0, COMPANY=1000)
*REC(EXPRESSION=(%Value%==1100) ?[SUPNOM].[Salary] : 0, COMPANY=1100)
*REC(EXPRESSION=(%Value%==1200) ?[SUPNOM].[Salary] : 0, COMPANY=1200)
*NEXT

I ask bc salary is just one value I need to save in the other company. The functional requirement is the next:

Payroll Budget must be in Company A and Company B, C or D, depend on the employee. The salary is not just one dimension member it is 10 to 17 members. Each employee belongs to company B, C or D, it is identified by a Value.

So I was planning on doing a for:

XDIM_MEMBERSET COMPANY= A
  *WHEN SUPNOM 

*For %BENEFIT%= B1, B2, B3..Bn
*IS Company
*REC(EXPRESSION=(%Value%==1000) ?[SUPNOM].[Salary] : 0, COMPANY=1000)
*REC(EXPRESSION=(%Value%==1100) ?[SUPNOM].[Salary] : 0, COMPANY=1100)
*REC(EXPRESSION=(%Value%==1200) ?[SUPNOM].[Salary] : 0, COMPANY=1200)
*next
former_member186338
Active Contributor
0 Kudos

For sure it's possible to loop on supnom is company. But at the end you will have very slow code. Just test yourself. Badi is a better solution for this requirement.

Answers (1)

Answers (1)

former_member186338
Active Contributor
0 Kudos

In general it's a bad idea to store member ID (company code) as a signeddata value. Script logic is badly supporting the logic required (can be done but will be very slow with a huge loop).

If you still want to use the described logic - write a custom logic badi or write back badi.