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

Re: [sqr-users] #Define variables



#Define is a compiler directive.  What you are doing with ...

   #Define no_columns #no_columns

...is telling the compiler that after this point in the code, substitute
the text "#no_columns" wherever you find the text "{no_columns}".  When
the program executes, it's using the numeric variable.  From what I can
see in your examples, get rid of the second #Define and use the numeric
variable, like....

!--start of program
#Define no_columns   8
BEGIN-PROGRAM
input $user 'Enter a user name'
move {no_columns} to #no_columns
IF $user = 'XXXX'
   let #no_columns = #no_columns + 1
END-IF
!--much more code
END-PROGRAM

...if you don't need the number of columns as the first thing in the code,
then you don't need the first #Define either, so it would be like...

!--start of program
BEGIN-PROGRAM
input $user 'Enter a user name'
move 8 to #no_columns
IF $user = 'XXXX'
   let #no_columns = #no_columns + 1
END-IF
!--much more code
END-PROGRAM

HTH,
Don

On Tue, 1 Mar 2005, Kevin Laroche wrote:

> Hi all
> I am trying to write dynamic reports that resize columns based on the #Define 
>no_columns
> variable.  I would like to add a feature so that if the user selects a 
>particular
> subset of data the report automatically adds a column and resizes all the 
>column widths.
> 
> I have been using 
> #define no_columns   8
> at the start of the report then I calculate  the size of the columns from 
>there
> 
> My question is...
> 
> This works but the report has to input the number of columns
> and I prefer not to link the form and the report that closely
> !--start of program
> #Define no_columns   8
> BEGIN-PROGRAM
> input #no_columns 'number of columns'
> #Define no_columns #no_columns
> !{no_columns} is redefined here to whatever number I want
> 
> !--much more code
> END-PROGRAM
> 
> This doesnt work
> !--start of program
> #Define no_columns   8
> BEGIN-PROGRAM
> input $user 'Enter a user name'
> IF $user = 'XXXX'
>    let #no_columns = {no_columns} 
>    let #no_columns = #no_columns + 1
>    !{no_columns} is not redefined here -results are uncertain at best
>    #Define no_columns #no_columns
> END-IF
> 
> !--much more code
> END-PROGRAM
> 
> Any suggestions from the guru's ?
> 
> Thanks
> 
> Brio 6.1 on Windows 2000 with Oracle 8i
> 
> 
> Kevin LaRoche - Oracle Forms and Brio too
> Ottawa Ontario
> 
> 
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users
> 

-----------------------------------------------------------------------
Donald Mellen  | Ray Ontko & Co. - Richmond, IN - http://www.ontko.com/
donm@ontko.com |  "In the beginning, there was nothing, which exploded"



_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users