sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Generate Report Separator Character

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    8 Posts 4 Posters 1.8k Views 4 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.
    • D Offline
      Dik Harrison
      last edited by

      I am trying to write a application to manipulate the CSV report generated by Generate Report. The problem that I have encountered is that when functions that have multiple arguments (i.e. animate) are included in the OnClick attribute, the parser I use does not handle the field correctly due to the extra commas. The same is true for descriptions that have commas. I'm sure that I could eventually work out a modification to the parser to fix this, but was wondering if there is a way to change the separator character used by Generate Report? In the past I have used "~" as the separator character when I was not in control of what the user could enter as data. Thus far, I haven't run into a problem with this since "~" is seldom used in American English. Any ideas out there?

      Have fun...

      Dik

      1 Reply Last reply Reply Quote 0
      • scottliningerS Offline
        scottlininger
        last edited by

        Hey Dik,

        Couple of options for you:

        1. See if you can find a better parser. The CSV that we output uses the "double quote as escape character" csv approach, so the output will look like this:
        "Value1","Value2","Value3","animate(""material"",""red"",""blue"")"
        

        Note that the quote characters inside the 4th value are double quoted to indicate that they're not termination characters. Your parser needs to be able to recognize that the commas inside 4th values are not separators since they're inside single quotes.

        1. Write or hire someone to write a custom Ruby exporter that does what you need. If you end up going down this road, feel free to PM me and loop me into the conversation. I could share some Ruby code that generates a simple report.

        Cheers,

        Scott Lininger
        SketchUp Engineer

        • Scott Lininger
          SketchUp Software Engineer
          Have you visited the Ruby API Docs?
        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          You could try this:

          "Value1","Value2","Value3","animate(""material"",""red"",""blue"")"

          Remove the leading and closing " and swap any (" or ") for ( or )
          Value1","Value2","Value3","animate(material"",""red"",""blue)
          Split using "," and immediately join with ,
          Value1,Value2,Value3,animate("material","red","blue")
          Split again using "","" and join with say ~ (or perhaps better | ?)
          Then you have a list that is , separated...
          Value1,Value2,Value3,animate(material|red|blue)
          Now you can go through each entry...
          If the entry contains | then strip the trailing ) and then split using (
          E.G. you now have 'animate' and 'material|red|blue'
          The later part can now be split using | to get the values...

          If you know the value with multiple fields will be called 'animate' then it's even easier...
          .

          TIG

          1 Reply Last reply Reply Quote 0
          • D Offline
            Dik Harrison
            last edited by

            Thanks TIG, I'll walk that through some sample data and see what I get. Unfortunately, I'll have no idea what might be in the data file. If I could control that, life would be easier.

            Edit: Sorry to report, but it failed on the first two sample files. There is a lot more variability than in the example that Scott gave.

            Have fun...

            Dik

            1 Reply Last reply Reply Quote 0
            • scottliningerS Offline
              scottlininger
              last edited by

              Dik,

              See attached for an example script for creating reports from Dynamic Component attributes. We tried to make it as instructive as possible, but please feel free to ask questions.

              I'll ask Simone, who wrote the script, to jump on this thread to help. πŸ˜„

              Example script for reporting (CSV, HTML) on DC Attributes

              • Scott Lininger
                SketchUp Software Engineer
                Have you visited the Ruby API Docs?
              1 Reply Last reply Reply Quote 0
              • snicoloS Offline
                snicolo
                last edited by

                Here I am ready for input and light 😲 criticism.

                Hope this helps and makes it easy for you to modify this for your own purpose.

                thanks.
                Simone.

                Simone Nicolo
                QA Manager
                http://www.sketchup.com

                1 Reply Last reply Reply Quote 0
                • snicoloS Offline
                  snicolo
                  last edited by

                  In the Ruby Example I gave you should be able to easily add/modify the csv format to use a different separator.

                  Change the following variables in the script to look like this
                  @cell_mid = "~"
                  @cell_end = "~"

                  Put the script in the Plugins directory start SU7 and ta-daaa!

                  And there you should have it.
                  Hope this helps.
                  Simone.

                  Simone Nicolo
                  QA Manager
                  http://www.sketchup.com

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    Dik Harrison
                    last edited by

                    Thank you Scott and Simone!

                    I'll jump on this as soon as I can.

                    Have fun...

                    Dik

                    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