Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    Proper script to create Map variable

    Scheduled Pinned Locked Moved Support
    buildmaster
    5 Posts 3 Posters 11 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      jstarbird_7831
      last edited by

      First off, can I create a map variable in the pipeline variables?

      If so what would be the format to create one that has a content something like the Deployment Variables, multiple sets of values.

      I've tried searching online but I couldn't find any examples like this.

      Product: BuildMaster
      Version: 5.6.8

      1 Reply Last reply Reply Quote 0
      • J Offline
        jharbison
        last edited by

        You mean something like this?

        set %ImAnEmptyMap = %();
        set %RectangleProperties = %(Sides:4,Color:blue,Coordinates:%(x:10,y:15),Environments:@(Dev, QA, Prod));
        

        https://inedo.com/support/documentation/otter/reference/otter-script/formal-grammar

        The formal definition of a map

        one of:
        
        • a variable_expression for a map (%) type, or a
        • a % character followed by left-parens ((), and any number of key-values pairs delimeted with commas (,), followed by a right-parens ()). A key-value pair consists of any_name, followed by a colon (:), followed by a literal_expression

        Also yes you can create a map variable in the pipeline variables.

        1 Reply Last reply Reply Quote 0
        • ? This user is from outside of this forum
          Guest
          last edited by

          something more like this, but proper format:

          set %shapes = %({type:square,size:7},{type:rectangle,size:9})

          Also hoping to do this in pipeline variables.
          I do have a workaround by using multiple maps with different names but the same key names but I was just wanting to see if this type of thing could be done.

          To better explain, I need to deploy multiple service instances for customers on our server with each having a unique name and several other settings but all using the same files. So I'm looking to loop through map keys to get the values I need for each one. (don't judge it's old software! ;-D)

          1 Reply Last reply Reply Quote 0
          • ? This user is from outside of this forum
            Guest
            last edited by

            It sounds like you want to create a list of maps.

            set @MyConfigurations = @(%(type:square,size:7),%(type:rectangle,size:9));

            1 Reply Last reply Reply Quote 0
            • ? This user is from outside of this forum
              Guest
              last edited by

              Yes, that is what I'm looking for. Sorry I didn't say it that way but I didn't think that was possible based on the docs, I thought having the sub-types like that was only in the maps.
              I tried that out and it works perfectly for me.

              Thanks!

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • 1 / 1
              • First post
                Last post
              Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation