[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Dynamic column type



Hello TIA
    Last time when I did dynamic column, I also faced the same problem
    with you. To solve this, I tried to assign constant (&Temp01) to
others
     variable and make if statement to check an empty $Temp01 ....
     This method will prevent garbage from previous value in constant
&Temp10
     This will not the best method but it work for me


******************************************
begin-select
[$Temp01] &A1=char
[$Temp02] &A2=char
[$Temp03] &A3=char
[$Temp04] &A4=char


    if $Temp01 <> ''
        LET $Val01 = &A1
        print $Val01    (+1,1,13)
    end-if
    if $Temp02 <> ''
        LET $Val02 = &A2
        print $Val02    (0,15,13)
    end-if
    if $Temp03 <> ''
        LET $Val03 = &A3
        print $Val03    (0,30,13)
    end-if
    if $Temp04 <> ''
        LET $Val04 = &A4
        print $Val04    (0,45,13)
end-if
***************************************************


for assiging $Temp01 = FieldString
I used this


!***********************************************************************
! Procedure Evaluate-Fieldtype                                         *
!***********************************************************************
begin-procedure Evaluate-Fieldtype

    let $Fieldstring = ''
    evaluate #Fieldtype
    when = 0 !char
        let $FieldString = $Fieldname
        break
    when = 1 !long
        show 'Long Type - not processed'
        break
    when = 2 !nbr
    when = 3 !sign
        let $FieldString = 'TO_CHAR(NVL(' || $Fieldname || ',0))'
        break
    when = 4 !date
    when = 6 !dttm
        let $FieldString = 'TO_CHAR(' || $Fieldname || ',' ||
'''YYYY-MM-DD''' || ')'
        break
    when = 5 !time
        let $FieldString = 'TO_CHAR(' || $Fieldname || ',' ||
'''HH:MM:SS''' || ')'
        break
    end-evaluate
end-procedure Evaluate-Fieldtype

Fieldtype is get from PSDBFIELD if you are using PeopleSoft



bye
Sehat Rosny





>In regards to this query back in May; did/has anyone managed to get a
>variable to dynamically assign NUMBER or CHAR to the dynamic column
>definition?
>ie:    let $ctype = 'NUMBER'
>
>
>begin-select
>[$A1]       &A1=$ctype
>........
>
>We cant get a clean compile using $ctype this way.
>
>TIA
>
>
>Adrian Clayfield
>    a..
>    b.. Subject: Re: Dynamic SQL Headscratcher
>    c.. From: Steve Bollinger <c_sbolli@QUALCOMM.COM>
>    d.. Date: Wed, 20 May 1998 09:15:36 -0700
>
>Have you tried a variable as coltype? ie. let $ctype = 'char' or 'number'at
>the
>time you define $scope1.  then[$SCOPE1]       &SCOPE1=$ctype
>...................
>Steve Bollinger
>
>
>At 08:43 AM 5/20/98 -0600, you wrote:>I'm working
>on a report that allows the users to include three of ten (orso) columns as
>an
>option (ie: they can pick 1, 2, or 3 columns to includein the std report.)>
>>To further complicate the issue, these columns can be numeric or character
>type.>>The following code works (but only when they have all three columns
>selected and when all three are of numeric type):>>...>avg_total_cash
>>[$SCOPE1]       &SCOPE1=NUMBER>[$SCOPE2]       &SCOPE2=NUMBER
>>[$SCOPE3]       &SCOPE3=NUMBER>  do PRINT_DETAIL>  from ...>
>>Any ideas on how to accomplish this?>>The only thing I've been able to
>think of is having one programdynamically write another program based on the
>user preferences....>>Thanks.>Salim.
>
>
>
>
>
>
>
>========================================================================
>Integrated Business Technologies Pty Ltd
>Level 11   55 Hunter St Sydney  2000
>Mobile: 0413 115580    Fax: 61 2 9223 4384
>Email:  adclay@ibt.com.au
>========================================================================
>
>
>