Skip to Content
0

Simulating Hierarchy Script Logic Que

Jan 17, 2017 at 01:01 AM

53

avatar image
Former Member

Hello Experts, I have a requirement where I have to create an account (well some acconts) and simulate that the new created Account is a Hierarchy. I Don't create a Hierarcy because that new account must be at base level. I have tried different ways to group the values that are suppoused to get saved in that account.

1. My first condition is that the Accounts that has the property HABS and Property zl4ceco get to the account LODGING EXPENSES.

2. The second condition is also the accounts that ID: 0000656003,0000656004,0000656005,0000656007 and property in Dimension CECO zl4ceco must be saved also inLODGING EXPENSES.

I have tried the next scripts so far:

*WHEN PF_CUENTAS.HAB
   *IS "Y"
    *WHEN PF_CECO.ZL4CECO
      *IS "1201"
         *REC(EXPRESSION= %VALUE%, PF_CUENTAS= LODGING EXPENSES, PF_CEBE= NA_CEBE, PF_CECO=NA_CECO, SOCIEDAD=NA_CCC)
    *ENDWHEN

*WHEN PF_CUENTAS
*IS 0000656003,0000656004,0000656005,0000656007
*WHEN PF_CECO.ZL4CECO
*IS 4701
*REC(EXPRESSION= %VALUE%, PF_CUENTAS= LODGING EXPENSES, PF_CEBE= NA_CEBE, PF_CECO=NA_CECO, SOCIEDAD=NA_CCC)
*ENDWHEN
*ENDWHEN
*ENDWHEN

Also tired with a for:

*SELECT (%HABS%, ID, PF_CUENTAS, HAB="Y"
*For %HAB%= %HABS%, 0000656003,0000656004,0000656005,0000656007
 *WHEN PF_CUENTAS
   *IS %HAB%
      *WHEN PF_CUENTAS.HAB
         *IS "Y"
           *WHEN PF.CECO.ZL4CECO
            *IS "1201"
              *REC(EXRPESSION= %VALUE%, PF_CUENTAS= LODGING EXPENSES, PF_CEBE= NA_CEBE, PF_CECO= NA_CECO, SOCIEDAD= NA_CCC)
            *ENDWHEN
      *ELSE
           *WHEN PF_CECO.ZL4CECO*IS "4701"
            *REC(EXRPESSION= %VALUE%, PF_CUENTAS= LODGING EXPENSES, PF_CEBE= NA_CEBE, PF_CECO= NA_CECO, SOCIEDAD= NA_CCC)
           *ENDWHEN
      *ENDWHEN
*ENDWHEN
*NEXT

Also tied something like:

// Costo de Habitaciones
*WHEN PF_CUENTAS.HAB
*IS "Y"
*WHEN PF_CECO.ZL4CECO
*IS "1201"
*REC(EXPRESSION= %VALUE%, PF_CUENTAS= LODGING EXPENSES, PF_CEBE= NA_CEBE, PF_CECO=NA_CECO, SOCIEDAD=NA_CCC)
*ENDWHEN

*WHEN PF_CUENTAS
*SELECT (%HABS%, ID, PF_CUENTAS, ID= 0000656003,0000656004,0000656005,0000656007) 
*IS LODGING EXPENSES
*WHEN PF_CECO
*IS NA_CECO
*REC(EXPRESSION= (%VALUE% +  [PF_CUENTAS].[%HABS%])=  PF_CEBE= NA_CEBE, PF_CECO=NA_CECO, SOCIEDAD=NA_CCC)
*ENDWHEN
*ENDWHEN
*ENDWHEN

I have tried other many ways but I don't get to save all the values in the account. Some cases I got saved just the 1 condition, sometimes the 2nd condition overwrites the 1st. What Am I doing wrong? Any suggestions?? any ideas??

Thanks for the posting.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Vadim Kalinin Jan 17, 2017 at 01:28 PM
0

Test this script:

*SELECT (%HABS%, ID, PF_CUENTAS, HAB="Y")
*WHEN PF_CUENTAS
*IS %HAB%
  *WHEN PF_CECO.ZL4CECO
  *IS 1201
    *REC(EXPRESSION= %VALUE%, PF_CUENTAS= LODGING_EXPENSES, PF_CEBE= NA_CEBE, PF_CECO=NA_CECO, SOCIEDAD=NA_CCC)
  *ENDWHEN
*IS 0000656003,0000656004,0000656005,0000656007
  *WHEN PF_CECO.ZL4CECO
  *IS 4701
    *REC(EXPRESSION= %VALUE%, PF_CUENTAS= LODGING_EXPENSES, PF_CEBE= NA_CEBE, PF_CECO=NA_CECO, SOCIEDAD=NA_CCC)
  *ENDWHEN
*ENDWHEN
Show 2 Share
10 |10000 characters needed characters left characters exceeded

P.S. Please remove duplicated answer!

1
Former Member

Thank you very much,

The code worked excellent.

Best Reards.

0
Vadim Kalinin Jan 17, 2017 at 07:00 AM
1

You missed a critical info - do you want to perform calculations in default.lgf?

Share
10 |10000 characters needed characters left characters exceeded
Vadim Kalinin Jan 17, 2017 at 01:19 PM
1

Never use account ID's with space inside the id! Like

PF_CUENTAS= LODGING EXPENSES

Unpredictable results with script logic!

Use LODGING_EXPENSES or something like...

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 17, 2017 at 01:09 PM
0

Hello Vadim,

I want to thank fistable for the post.

Actually the requirement is because this user is in a depatment that they plan per Income Statement. They do have the details but in this particular case they want to do somthing like scenarios what if.

How do they want to see the info?:

For instance.

My Income for department X is the combination of 3 Accounts +1 Profit Center and my expenses for department X is the combination of 30 accounts: 26 for Cost Center 1201 and 4 for Cost Center 4701. This is Kind of the example of the script logic.

I have to save for department X

INCOME -> 3 Accounts + 1 Profit Ctr.

EXPENSES -> 26 Acounts with cost center 1201 + 4 accounts with Cost Center 4701.

I have an atribute for those 26 accounts since are part of a department but the other 4 I don´t.

About the question for default.lgf

I was thinking on doing it on a Data Manager on demand, since they need to do this on time. Since the the income and Expenses depends on other variables they want to have sumarized in INCOME and EXPENSES to do the analysis and scenariso what if.

Best Regards.

Share
10 |10000 characters needed characters left characters exceeded