Drawing pivots using a script

Optuma Forums Optuma Scripting Drawing pivots using a script

This topic contains 3 replies, has 3 voices, and was last updated by Matthew Matthew 2 months, 1 week ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #51575
    Avatar
    Steve
    • Topics: 9
    • Replies: 19
    • Posts: 28

    Ok – so I thought I’d try creating a script to add / remove pivot lines to my charts – but I’ve fallen at the first hurdle.

     

    My script (so far) is:

    PP = pivots(PIVOTS=Monthly);
    R1 = pivots(DEFAULT=R1, PIVOTS=Monthly);
    R2 = Pivots(DEFAULT=R2, PIVOTS=Monthly);
    R3 = pivots(DEFAULT=R3, PIVOTS=Monthly);
    S1 = pivots(DEFAULT=S1, PIVOTS=Monthly);
    S2 = pivots(DEFAULT=S2, PIVOTS=Monthly);
    S3 = pivots(DEFAULT=S3, PIVOTS=Monthly);

    However this gives me an error message in the script editor – ‘Please enter a valid script to add this criteria’

    Next step is to plot these variables, however I’m not sure what I’m missing above.

    Thanks
    Steve

     

    #51583
    Avatar
    Trevor R
    • Topics: 32
    • Replies: 106
    • Posts: 138

    Hi Steve,

    I’m guessing that this is what you were hoping to see:

    20190312 Steve's Scripts

     

    The first issue with your scripts is that you’ve assigned variable codes, R1, R2, R3 S1, etc that are the same as parameters used in the PIVOTS() function, eg PIVOTS(DEFAULT=R1, PIVOTS=Monthly) . This will cause the Function to try and call that variable of the same name – a No No! Thus I’ve started all those variables with a “v” to distinguish them from the function parameters.

    Next you need to define the Plots you wish to display. So here is the script code that I used to generate the above chart with SHOWPLOT tool calling the script:

    // Steve Script – Script Forum #51575 20190312

    PP = pivots(PIVOTS=Monthly);

    vR1 = pivots(DEFAULT=R1, PIVOTS=Monthly);

    vR2 = Pivots(DEFAULT=R2, PIVOTS=Monthly);

    vR3 = pivots(DEFAULT=R3, PIVOTS=Monthly);

    vS1 = pivots(DEFAULT=S1, PIVOTS=Monthly);

    vS2 = pivots(DEFAULT=S2, PIVOTS=Monthly);

    vS3 = pivots(DEFAULT=S3, PIVOTS=Monthly);

    Plot1 = PP; Plot1.Colour = Red;

    Plot1.LineStyle = Solid;

    Plot2 = vR1;

    Plot2.Colour = Blue;

    Plot2.LineStyle = Dash;

    Plot3 = vR2;

    Plot3.Colour = Blue;

    Plot3.LineStyle = LongDash;

    Plot4= vR3;

    Plot4.Colour = Blue;

    Plot4.LineStyle = DashDot;

    Plot5 = vS1;

    Plot5.Colour = Green;

    Plot5.LineStyle = Dash;

    Plot6 = vS2;

    Plot6.Colour = Green;

    Plot6.LineStyle = LongDash;

    Plot7= vS3;

    Plot7.Colour = Green;

    Plot7.LineStyle = DashDot;

    Incidentally, if you are wanting a result to use with a SHOWBAR, the final result of your script must not have a “;”, all other lines in the script must have one.

    Cheers

    Trevor

    The Auld Tyma at

    Auld Tyma Data Logo with URL 1 cm

     

    #51591
    Avatar
    Steve
    • Topics: 9
    • Replies: 19
    • Posts: 28

    Yes – that’s put me on the right course. Thanks Trevor for the help.    

     

     

    PS – I’ve gone to adjust the pivot colours – is there an alphabetical list of available colours? (ie the name of the colour to use within the script – sure red, green, blue is fine but is it light grey, teal / aqua? etc ).  I’ve gone looking but haven’t found anything.

    Thanks

     

    #51599
    Matthew
    Matthew
    • Topics: 4
    • Replies: 137
    • Posts: 141

    Hi Steve,

    When you are typing in the Plot colour line of the script a drop down window will display to show you all available options.  You can see more information on how to setup multi-plot scripts (including colours) here:

    https://help.optuma.com/kb/faq.php?id=722

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close