• 217 views | 3 messages Discussion: LEAP
    Topic: API AddCategory ErrorSubscribe | Previous | Next
  • Tomás Mac Uidhir 2/17/2016

    449 Views

    Hi Guys,

    I am trying to create a new folder structure through the API and I am getting an error straight away, script running is:
    ---------------------------------------
    LEAP.ActiveArea = "Freedonia"
    LEAP.ActiveScenario = "Reference"
    PRINT LEAP.ActiveArea.Name
    PRINT LEAP.ActiveScenario.Name
    LEAP.Activeview = "Analysis"
    LEAP.ActiveYear = 2010
    AddCategory ("test", 1, "million", "household")
    ----------------------------------------
    Error message received is as follows:

    Error in script: Cannot use parentheses when calling a Sub
    Language: VBScript
    Line/Column 13/47

    Hopefully this is just a simple error message relating to a syntax error.

    Regards
    Tom��s
  • Taylor Binnington 2/18/2016
      Best Response

    447 Views

    Thanks for this, Tomas - very sorry it's taken me a while to respond (I know you had emailed as well).

    Try the following:

    ---------------------------------------
    LEAP.ActiveArea = "Freedonia"
    LEAP.ActiveScenario = "Reference"
    PRINT LEAP.ActiveArea.Name
    PRINT LEAP.ActiveScenario.Name
    LEAP.Activeview = "Analysis"
    LEAP.ActiveYear = 2010
    set temp = AddCategory("test", 1, "million", "household")
    ----------------------------------------

    I know this is mysterious, and it's not mentioned in the documentation. Some of the branch manipulation methods in the API return a value and therefore require assignment. In this example, 'temp' is a LEAP Branch object. You may not need to perform any further operations with 'temp', but it's assignment is required in order to add the category.

    Best,
    Taylor
  • Tomás Mac Uidhir 2/22/2016
      Best Response

    426 Views

    Hi Taylor,

    This is great thank you for taking the time to write back. I have made some progress with the scripting since I posted the query but I am sure I will need to revert to the message boards again soon for further help.

    Thanks again,
    Tomas Maguire