Results 1 to 3 of 3

Thread: [RESOLVED] Crystal Report - Formula not working

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Posts
    1,384

    Resolved [RESOLVED] Crystal Report - Formula not working

    I am trying to figure out how many TenThousands; Thousands; Hundreds; Tens are in a Number. (Sum ({@Line Total}, {tblMemPay.Member}) being the number). I keep getting an Error - The remaining text does not appear to be part of the formula.
    Code:
    Global CurrencyVar NoTenThou;
    Global CurrencyVar NoThou;
    Global CurrencyVar NoHund;
    Global CurrencyVar NoTen;
    Global CurrencyVar Remain;
    
    if Sum ({@Line Total}, {tblMemPay.Member}) >= 10000 then
        NoTenThou = int(Sum ({@Line Total}, {tblMemPay.Member})/10000)
        //Error Here
        Remain = NoTenThou Mod ToNumber((Sum ({@Line Total}, {tblMemPay.Member})/10000))
    else if Sum ({@Line Total}, {tblMemPay.Member}) >= 1000 then
        NoTenThou = 0
        NoThou = int(Sum ({@Line Total}, {tblMemPay.Member})/1000)
        Remain = NoThou Mod ToNumber((Sum ({@Line Total}, {tblMemPay.Member})/1000))
    
        NoHund = int(remain/100)
        Remain = NoHund Mod ToNumber(Remain/100)
    
        NoTen = int(Remain/10)
    else if Sum ({@Line Total}, {tblMemPay.Member}) >= 100 then
        NoTenThou = 0
        NoThou = 0
    
        NoHund = int(remain/100)
        Remain = NoHund Mod ToNumber(Remain/100)
    
        NoTen = int(Remain/10)
    else if Sum ({@Line Total}, {tblMemPay.Member}) >= 10 then
        NoTenThou := 0
        NoThou := 0
        NoHund := 0
        NoTen = int(Remain/10)
    else if Sum ({@Line Total}, {tblMemPay.Member}) >= 1 then
        NoTenThou := 0
        NoThou := 0
        NoHund := 0
        NoTen := 0
    End If
    Can someone please help?
    Mel

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Crystal Report - Formula not working

    Since you are using Crystal Syntax, if the IF Block contains multiple statements they must be within () and each statement must end with a ; (the last line of the block this is optional)

    Code:
    if Sum ({@Line Total}, {tblMemPay.Member}) >= 10000 then
     (
        NoTenThou = int(Sum ({@Line Total}, {tblMemPay.Member})/10000);
        //Error Here
        Remain = NoTenThou Mod ToNumber((Sum ({@Line Total}, {tblMemPay.Member})/10000));
     )
    else if Sum ({@Line Total}, {tblMemPay.Member}) >= 1000 then
     (
        NoTenThou = 0;
        NoThou = int(Sum ({@Line Total}, {tblMemPay.Member})/1000);
        Remain = NoThou Mod ToNumber((Sum ({@Line Total}, {tblMemPay.Member})/1000));
    
        NoHund = int(remain/100);
        Remain = NoHund Mod ToNumber(Remain/100);
    
        NoTen = int(Remain/10);
     )
    Else...

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Posts
    1,384

    Re: Crystal Report - Formula not working

    Thanks a mill. I knew it was some simple syntax thing (self thought). I tried it with the brackets, but without the semi-colon, and I tried with with the semi-colon but no brackets

    Thanks again
    Mel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width