sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    WebDialog question

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 3 Posters 197 Views 3 Watching
    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.
    • N Offline
      NewOne
      last edited by

      hello, I want to pass two parameters like this:

      query = 'skp;send_values@' + val1 + 'WHAT HERE?' + val2;
      

      but I don't know how to concatenate val 1 + val2. I tried with @, with &, but doesn't work.
      Any suggestion ?

      1 Reply Last reply Reply Quote 0
      • fredo6F Offline
        fredo6
        last edited by

        @newone said:

        hello, I want to pass two parameters like this:

        query = 'skp;send_values@' + val1 + 'WHAT HERE?' + val2;
        

        but I don't know how to concatenate val 1 + val2. I tried with @, with &, but doesn't work.
        Any suggestion ?

        Unless val1 and val2 are strings, you need to convert them to strings.
        Use val1.toString()

        Fredo

        1 Reply Last reply Reply Quote 0
        • N Offline
          NewOne
          last edited by

          @unknownuser said:

          Unless val1 and val2 are strings, you need to convert them to strings.
          Use val1.toString()

          Fredo

          I need them as array elements in ruby, that is why I want to concatenate them as separate parameters.

          1 Reply Last reply Reply Quote 0
          • fredo6F Offline
            fredo6
            last edited by

            @newone said:

            I need them as array elements in ruby, that is why I want to concatenate them as separate parameters.

            In Javascript you can use the .join() function (very similar to the Ruby one) to convert a list to a string with separator.
            for instance val1.join(';').

            The only thing you have to keep in mind is that the transmission to Ruby is done with a String after the @. So up to you to encode in JavaScript and decode in Ruby.

            Fredo

            1 Reply Last reply Reply Quote 0
            • N Offline
              NewOne
              last edited by

              @unknownuser said:

              @newone said:

              I need them as array elements in ruby, that is why I want to concatenate them as separate parameters.

              In Javascript you can use the .join() function (very similar to the Ruby one) to convert a list to a string with separator.
              for instance val1.join(';').

              The only thing you have to keep in mind is that the transmission to Ruby is done with a String after the @. So up to you to encode in JavaScript and decode in Ruby.

              Fredo

              Thanks! This is what I am going to do. I will separate the string in ruby, to get desired array.

              1 Reply Last reply Reply Quote 0
              • M Offline
                MartinRinehart
                last edited by

                You might want to think about using JSON. It's a bit more general, can be really light weight and if you know JavaScript you already know JSON. Example:

                JSON array: comma-separated list of items enclosed in square brackets.

                Sample: ['string one', 'string two']

                It's a wee bit of extra work, but if you ever want to share data elsewhere ...

                Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement