Skip to Content
avatar image
Former Member

How to sorting the data in for...next function

Hi expert,

I use "For...Next" function in case of divested entity in logic script and identify 3 variables in script which is retrieved from entity property dimension. Set of data that is used in script came from Entity Dimension as table below:

and the below is script

I expect that script should be run each set of data separately but in fact script will be sorted each property first then run script so the data that I get, it will show as below:

You can find that Entity B is disposed in year 2017 in first table but when I check the result, it is work like disposed in year 2015 while Entity D should be disposed in year 2015 but it work like disposed in year 2017.

My question is:

1.) Can I use For...Next function in this case? If not, can I use any function, please recommend me, I will be appreciated too much.

2.) If yes in the first question, please correct me that should I revise script or add something else for making script work correctly

Thanks in advance for your help and Happy New Year everyone.

Bam

capture1.png (5.3 kB)
script.png (19.2 kB)
capture2.png (5.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Dec 27, 2017 at 09:14 AM

    Just performed simple test in UJKT with ENVIRONMENTSHELL copy:

    ENTITY dimension:

    Script:

    *SELECT(%ENS%,[ID],ENTITY,[DISPOSAL]=Y)
    *XDIM_MEMBERSET ENTITY=%ENS%
    *SELECT(%TIDS%,[DATE_CHANGE],ENTITY,[DISPOSAL]=Y)
    *SELECT(%YS%,[YEAR_CHANGE],ENTITY,[DISPOSAL]=Y)
    *FOR %EN%=%ENS% AND %TID%=%TIDS% AND %Y%=%YS%
    *XDIM_MEMBERSET ENTITY=%EN%
    *XDIM_FILTER TIME = [TIME].properties("TIMEID") = "%TID%"
    *XDIM_FILTER TIME = [TIME].properties("YEAR") = "%Y%"
    *NEXT

    UJKT result:

    LGX:
    
    *XDIM_MEMBERSET ENTITY=BR,CA,DE,FR
    *XDIM_MEMBERSET ENTITY=BR
    *XDIM_FILTER TIME = [TIME].properties("TIMEID") = "20140800"
    *XDIM_FILTER TIME = [TIME].properties("YEAR") = "2014"
    *XDIM_MEMBERSET ENTITY=CA
    *XDIM_FILTER TIME = [TIME].properties("TIMEID") = "20151200"
    *XDIM_FILTER TIME = [TIME].properties("YEAR") = "2015"
    *XDIM_MEMBERSET ENTITY=DE
    *XDIM_FILTER TIME = [TIME].properties("TIMEID") = "20161000"
    *XDIM_FILTER TIME = [TIME].properties("YEAR") = "2016"
    *XDIM_MEMBERSET ENTITY=FR
    *XDIM_FILTER TIME = [TIME].properties("TIMEID") = "20171000"
    *XDIM_FILTER TIME = [TIME].properties("YEAR") = "2017"

    Looks correct!

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 27, 2017 at 07:26 AM

    Please provide a full script, and post it as a text, not as picture. I don't see definition of variables.

    Also please explain the required calculation logic.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 01 at 05:03 AM

    Happy New Year Vadim,

    Thanks a lot for your answer...First I will try to revise my script as your suggestion and let you know about the result.

    Bam

    Add comment
    10|10000 characters needed characters exceeded