• Passing an array to OpenArgs

    • This topic has 5 replies, 4 voices, and was last updated 15 years ago.
    Author
    Topic
    #468788

    Is there any way to pass an array as the OpenArg argument when opening a form? I want to pass several opening arguments, and it would be eaier to pass them in an array than to parse them out using a specific character as a separator (which is what I’m doing at the moment). I could use the same process to take the values in an array, create a string and send them to OpenArgs, then parse them back into an array on opening the form, but there doesn’t seem to be much point in the context I’m currently using.

    Thanks.

    Viewing 4 reply threads
    Author
    Replies
    • #1222939

      OpenArgs is defined as a string so I think you are stuck with what you have now.
      But it would be interesting if someone knows of a way around this.

    • #1223052

      John is completely correct in that OpenArgs is a string. You might want to consider making the array public and then passing information via the OpenArgs to tell the form to go look at the public array. Might be lots easier than creating the string, then parsing it again on the other side. Just a thought.

    • #1227460

      Sorry, John and Larry – I completely missed your postings, but appreciate your response.

      At least I know I hadn’t missed something obvious, but agree that the best option might be to have an array as a global variable, so will give that a go.

      Thanks for your feedback.

      Cheers, Alison

    • #1227555

      I do this a lot. Split and Join are your friends.
      Join takes an array and creates a string with a certain delimter between each item. Split does the reverse.
      Consider your data when deciding on the delimter – space or comma are common, although I often use the colon ‘:’ as the delimiter.
      It’s always good to minimise the use of global variables.
      Peter

    • #1227652

      Why didn’t I think of that? I’ve used Split and Join before, but completely managed to forget about them in this context!

      I do try to limit my global variables to avoid problems with values not being cleared at the right time, so this is just what I was looking for.

      Thanks, Peter.

      Cheers, Alison

    Viewing 4 reply threads
    Reply To: Passing an array to OpenArgs

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: