[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::amiga_v1

Title:AMIGA NOTES
Notice:Join us in the *NEW* conference - HYDRA::AMIGA_V2
Moderator:HYDRA::MOORE
Created:Sat Apr 26 1986
Last Modified:Wed Feb 05 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:5378
Total number of notes:38326

4160.0. "Superbase Pro Programming problem" by BELFST::MCCLINTOCK (Peter) Fri Sep 28 1990 17:58

I have been having some difficulty with some of the facilities of
the programming with Superbase Pro.

The first problem I encountered was the TODAY keyword.  I can't
make this work in any shape or form.  The exemples in the manual
produce an error if I try them. eg. ?TODAY

If I run the example program Client.deps I get:

          Can't do this ...
          TODAY
          Misplaced command.

the line highlighted is:

    OFF ; BF ; UL ;@23 "Clients' Deposits on ";&12 TODAY

seems simple enough.

The other problem is with SUM used in an AFTER GROUP line in a report.

          AFTER GROUP R_No.Receipts
          ? BF OFF ; IT OFF ; UL OFF ;@2;"Total for Group";@19;
            &4R_No.Receipts;@45;&15 SUM R_Amount.Receipts

This program is exactly as produced by the Forms Editor.

When I try running it I get:

           Can't do this...
           Invalid parameter

Apart from these problems everything else seems to work OK.  I don't think
that I am doing anything wrong in Superbase ... could it be something
else connected with my environment or the Shell that I use.  (I am running
ARP and AShell.)

Any help would be appreviated.

Peter
T.RTitleUserPersonal
Name
DateLines
4160.1SAUTER::SAUTERJohn SauterFri Sep 28 1990 18:397
    My memory is vague, but I seem to recall that the manual is inaccurate
    or incomplete about these functions.  I think TODAY takes a parameter
    (which it ignores) and the argument of SUM must be declared in a GROUP.
    
    Sorry to be so uncertain, but I solved these two problems quite a while
    ago, and I don't remember the solutions for certain.
        John Sauter
4160.2It mustn't be today??BELFST::MCCLINTOCKPeterFri Sep 28 1990 22:4313
    Thanks for the suggestions.  I've tried giving today an argument,
    perhaps you could try it for me??
    
    Using the Command option: Amiga/A try to execute
    
    	?TODAY
    or	?TODAY()
    	etc.
    
    Let me know if you can get anything to work.  I appreciate the help
    .. this is getting a bit frustrating.
    
    Peter 
4160.3SUM success.BELFST::MCCLINTOCKPeterFri Sep 28 1990 22:5812
    John,
    
    You are right about the SUM function.  Declaring the field to be
    totalled in the GROUP statement fixes it.
          
    Strange though that when the program is generated with the Forms
    editor it doesn't do this.  I am only able to do it by editing the
    program before running it.   Is there a way that you know of to
    declare the field in the Group statement when generating the report
    from the Forms Ed.
          
    Peter      
4160.4examplesSAUTER::SAUTERJohn SauterMon Oct 01 1990 10:3392
    I don't read notes much from home, so I didn't see your request to try
    the TODAY function.  I did, however, upload a couple of programs I have
    been using for a while.  It appears that my memory of the TODAY
    function was incorrect.  I hope these two examples are helpful.
    
    I don't use the form editor except to create appearances, so I don't
    know about creating programs from the forms editor.
        John Sauter
    ============================================================================
 OPEN FILE "categories"
 OPEN FILE "checkbook"
 
 REPORT amount.checkbook

 AFTER REPORT 
 ? 
 ? "This week's expenses total ", SUM (amount.checkbook)
 END REPORT 
 
 FOOTING 2
 ? 
 ? BF OFF ; IT OFF ; UL OFF ;"Weekly Expenses "; TODAY ;" "; NOW ;" page "; STR$ ( PG ,"z99")
 END FOOTING 
 
 GROUP category.checkbook,amount.checkbook,check_no.checkbook

 BEFORE GROUP category.checkbook
 EJECT 5
 ? 
 ? BF OFF ; IT OFF ; UL OFF ;" Category ";category_name.categories;"                          ";category.checkbook
 END GROUP 
 
 AFTER GROUP category.checkbook
 IF COUNT > 1 THEN ? BF OFF ; IT OFF ; UL OFF ;@48;"subtotal is "; SUM (amount.checkbook)
 END GROUP 
 
 SELECT BF OFF ; IT OFF ; UL OFF ;
 LEFT$ (party,49);@50check_no.checkbook;split.checkbook;" ";amount.checkbook
 WHERE category.checkbook = category_no.categories AND category.checkbook > 0 AND (date_budgeted.checkbook = DAYS ("31-Dec-9999"))
 ORDER category.checkbook,check_no.checkbook,split.checkbook,date_written.checkbook,date_entered.checkbook,time_entered.checkbook
 TO PRINTER 
  QUIT 

    
    ============================================================================
 OPEN FORM "transfer"
 FILE "checkbook"
 INDEX "check_no"
 
 ON ERROR GOTO goterror

nexttransfer: 
 FORM 1
 BLANK 
 LET category_name.checkbook = " "
 LET date_returned.checkbook = TODAY 
 LET check_no.checkbook = 0
 LET split.checkbook = "@"
 LET date_written.checkbook = TODAY 
 ENTER category.checkbook
 ENTER amount.checkbook
 ENTER party.checkbook
timeagain1: 
 LET date_entered.checkbook = TODAY 
 LET time_entered.checkbook = NOW 
 IF date_entered.checkbook <> TODAY THEN GOTO timeagain1 END IF 
 LET date_budgeted.checkbook = "31-Dec-9999"
 LET was_budgeted.checkbook = "S"
 LET amount.checkbook = - amount.checkbook
 STORE 
 BLANK DUPLICATE 
 FORM 2
 LET category.checkbook = 0
 LET amount.checkbook = - amount.checkbook
 ENTER category.checkbook
timeagain2: 
 LET date_entered.checkbook = TODAY 
 IF time_entered.checkbook = NOW THEN GOTO timeagain2 END IF 
 LET time_entered.checkbook = NOW 
 IF date_entered.checkbook <> TODAY THEN GOTO timeagain_2 END IF 
 STORE 

 GOTO nexttransfer

goterror: 
 SELECT LAST 
 SET RECORD ON 
 VIEW 
 END 


    
4160.5Must be me??BELFST::MCCLINTOCKPeterMon Oct 01 1990 17:3123
    John,
    
    I clearly have a Superbase or environment problem here.  I have
    tried executing pieces of your code (extracted from the note) to
    make sure that I am not making any stupid syntax errors.
    
    When the system finds a line with TODAY or NOW in it I get:
    
    Can't do this... 
    TODAY
    Misplaced command
    
    or 
    
    Can't do this... 
    NOW
    Misplaced command
       
    I'll try calling Precision Software and reporting the problem to
    them.  I'll post the outcome here.
    
    Thanks
    Peter 
4160.6SAUTER::SAUTERJohn SauterMon Oct 01 1990 18:288
    When you call, be sure to mention your version number.  I sent for the
    non-protected copy, and got version 3.02.
    
    The text I posted was generated using the SAVE TEXT feature.  There
    appears to be a bug in this feature: it inserts carriage return
    characters at end of line.  I suspect it is a port from an MS-DOS
    machine.
        John Sauter
4160.7RETURN=OFFBELFST::MCCLINTOCKPeterTue Oct 02 1990 07:2610
>    The text I posted was generated using the SAVE TEXT feature.  There
>    appears to be a bug in this feature: it inserts carriage return
>    characters at end of line.  I suspect it is a port from an MS-DOS
>    machine.

    You can change this by putting RETURN=OFF in the tool types of the
    Superbase or Program icon.
    
    Peter

4160.8SAUTER::SAUTERJohn SauterTue Oct 02 1990 09:254
    re: .7
    
    Thanks.  I don't recall seeing that anywhere in the documentation.
        John Sauter
4160.9Problem SolvedBELFST::MCCLINTOCKPeterWed Oct 03 1990 07:426
    The copy of SBPRO on my hard disk must have been corrupted somehow.
    Copying a fresh version from the distribution solved the problem.
    
    I should have thought of this earlier.  Thanks for the help.
    
    Peter