ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

in wrkqyr how to convert char to numeric and summary it?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • in wrkqyr how to convert char to numeric and summary it?

    hi,dear
    in wrkqry how to convert char to numeric and summary it?
    thanks.

  • #2
    Re: in wrkqyr how to convert char to numeric and summary it?

    PL421,

    This is the same situation as your last post concerning converting a -1 to some character. Unfortunately you don't have "If Then Else" statements in WrkQry. Please see the original thread and adapt it to generate your summary. It's going to take 2-3 passes through the data to select the records you want, convert them to values and then summarize them.

    See original thread here

    -R

    Comment


    • #3
      Re: in wrkqyr how to convert char to numeric and summary it?

      Hi,

      the only way you can do this is:
      Create an character representation of a timestamp, where your character value represents the microseconds. Then convert the character timestamp into a real timestamp. After retrieve the mircoseconds from the timestamp.

      If your character data are longer than 6 digits, you have to built several timestamps and multiply.

      Example:
      PHP Code:
      Field
      TIMESTAMP   timestamp
      ('0001-01-01-00.00.00.' 
                  
      !!MyChar)                         

      NUM         microsecond(timestamp(           
                  
      '0001-01-01-00.00.00.'!!MyChar)) 
      With NUM you can calculate now, like with any other numeric field

      Birgitta
      Last edited by B.Hauser; March 7, 2006, 05:58 AM.

      Comment


      • #4
        Re: in wrkqyr how to convert char to numeric and summary it?

        Thank You Very Much!

        Comment

        Working...
        X