2 Replies Latest reply on Sep 6, 2012 12:47 PM by philmodjunk

    Parsing text

    galeton

      Title

      Parsing text

      Post

      Hi. I have a database where I am parsing json text. All is going well except one field. I have a field called "publish_date" which represents the copyright date. When the text is imported it looks like this. "publish_date";"1990", My current formula is If(PatternCount ( BOOK::json ; "publish_date" ) = 1 ; parseJSON ( BOOK::json; "publish_date" ; ","  );""). This works well in cases where all I have is the month and year or just the year. But I run into problems when there's a comma in the date such as "Janurary 4, 1990",   The date appears as January 4 because it stops at the first comma. Is there a way to work around this so the date will be parsed correctly whether there is a comma in the date or not? I've spent most of the day trying to figure out a workaround but no luck. Thanks for any help.

       

        • 1. Re: Parsing text
          raybaudi

          Please, write down the parseJSON custom function.

          • 2. Re: Parsing text
            philmodjunk

            Hmmmm, maybe this approach will work:

            Let's say you use:

            If [If(PatternCount ( BOOK::json ; "publish_date" ) ]
              Set variable [$PubDate ; parseJSON ( BOOK::json; "publish_date" ; ","  )]

              If [ GetAsNumber ( RightWords ( $PubDate ; 1 ) ) < 1000 ]
                  Set Variable [$Pubdate ; $PubDate & ", " & parseJSON ( BOOK::json; $Pubdate ; ","  ) ]
              End IF

            End If