4 Replies Latest reply on Aug 7, 2008 7:41 AM by Newsgroup_User

    Need help with displaying only part of a message as summary

    Level 7
      I want to use an existing table that contains a summary for the item
      details..

      But on my page i want to display say the first 6 words or 35 characters as a
      summary for an item, and use that as the link to the details page...

      Not sure how to search for this, if someone can point me in the right
      direction on what to search for?


      Current summary:
      this item is a great addition to your purchase and has alot of extra
      features

      Wanted summary:
      This item is a great addition to........

      i dont want to have to create a new table for the client to add the
      information again, i want to use the existing data and just display what i
      want on the page..





      --
      ASP, SQL2005, DW8 VBScript, Visual Studio 2005, Visual Studio 2008


        • 1. Re: Need help with displaying only part of a message as summary
          bregent Most Valuable Participant
          In VBScript you would use the Left function to grab how ever many characters you want from the left hand side of a string. That's it.
          • 2. Re: Need help with displaying only part of a message as summary
            Level 7
            that seems to work great..
            thanks...

            by chance is there a way to do this but allow the last word to be complete?
            Example:

            Currently:
            Today the weather was gr...

            Would like:
            Today the weather was great...

            --
            ************************************************
            ASP, SQL2005, DW8 VBScript, Access
            "bregent" <webforumsuser@macromedia.com> wrote in message
            news:g7d8v5$o3i$1@forums.macromedia.com...
            > In VBScript you would use the Left function to grab how ever many
            > characters you want from the left hand side of a string. That's it.


            • 3. Re: Need help with displaying only part of a message as summary
              bregent Most Valuable Participant
              >by chance is there a way to do this but allow the last word to be complete?

              There is no VBScript functions for this, but you should be able to build one easily with just a few lines of code by searching for the space character. Start by setting up a loop and use the loop variable as the length argument of the Left function. Initialize the loop to whatever you want the minimum character length to be - say 30 for example.

              Test the character at the loop counter position (use the Mid function) and if it's the space, stop looping. If it's not a space, increment and then test again. Once you find the position of the space, use the counter value as the argument to the Left function.
              • 4. Re: Need help with displaying only part of a message as summary
                Level 7
                Cool, ill have to play around with that.. thanks..

                --
                ASP, SQL2005, DW8 VBScript, Visual Studio 2005, Visual Studio 2008
                "bregent" <webforumsuser@macromedia.com> wrote in message
                news:g7e07c$h00$1@forums.macromedia.com...
                > >by chance is there a way to do this but allow the last word to be
                > >complete?
                >
                > There is no VBScript functions for this, but you should be able to build
                > one
                > easily with just a few lines of code by searching for the space character.
                > Start by setting up a loop and use the loop variable as the length
                > argument of
                > the Left function. Initialize the loop to whatever you want the minimum
                > character length to be - say 30 for example.
                >
                > Test the character at the loop counter position (use the Mid function) and
                > if
                > it's the space, stop looping. If it's not a space, increment and then test
                > again. Once you find the position of the space, use the counter value as
                > the
                > argument to the Left function.
                >
                >