Else If help (1 Viewer)

tmaleski

New member
Local time
Today, 17:33
Joined
Jul 2, 2007
Messages
2
// This adjusts the paper size based upon the standard paper sizes
if RoundUp ({argReportsEx.HeightImperial}, 0) < 25 then
if RoundUp ({argReportsEx.WidthImperial},0 )< 9 then 8
else if RoundUp ({argReportsEx.WidthImperial},0 ) < 10 then 9
else if RoundUp ({argReportsEx.WidthImperial},0 ) < 12 then 11
else if RoundUp ({argReportsEx.WidthImperial},0 ) < 13 then 12
else if RoundUp ({argReportsEx.WidthImperial},0 ) < 19 then 18
else if RoundUp ({argReportsEx.WidthImperial},0 ) < 25 then 24
else 30

I get an error msg "While attempting to display the report, the following error occurred: Anumber, currency... is expected here......."
 
Does it indicate where the number / currency is expected?

One thing that looks a bit strange is that there's no number at the end of line 2.

Peter
 
// This adjusts the paper size based upon the standard paper sizes
if RoundUp ({argReportsEx.HeightImperial}, 0) < 25 then
if RoundUp ({argReportsEx.WidthImperial},0 )< 9 then 8
else if RoundUp ({argReportsEx.WidthImperial},0 ) < 10 then 9
else if RoundUp ({argReportsEx.WidthImperial},0 ) < 12 then 11
else if RoundUp ({argReportsEx.WidthImperial},0 ) < 13 then 12
else if RoundUp ({argReportsEx.WidthImperial},0 ) < 19 then 18
else if RoundUp ({argReportsEx.WidthImperial},0 ) < 25 then 24
else 30

I get an error msg "While attempting to display the report, the following error occurred: Anumber, currency... is expected here......."

I am not exactly sure why you have this error, but with this many Else If Statements in your code, you may want to consider using Select/Case Statements instead.
 
Thank you for the help.

No number after line two, I want a nested if statement

Case function, can you give an example?
 
Thank you for the help.

No number after line two, I want a nested if statement

Case function, can you give an example?

The format for Select/Case is similar to the following (remember that you need to substitute as required:
Code:
[B]Select[/B]([COLOR=green][B]SomethingtoSelect[/B][/COLOR]}
    [B]Case[/B] [B]{[COLOR=green]Condition or Range1[/COLOR]}[/B]:
        [B][COLOR=black]Action to take[/COLOR][/B]
 
    [B]Case[/B] [B]{[COLOR=green]Condition or Range2[/COLOR]}[/B]:
        [COLOR=blue][B]Action to take[/B][/COLOR]
[B].[/B]
[B].[/B]   [B]{[COLOR=green]More Cases go here[/COLOR]}[/B]
[B].[/B]
    [COLOR=black][B]Default[/B][/COLOR]: [B]{[COLOR=black]Condition or Range[/COLOR]}[/B]
        [COLOR=blue][B]Action to take[/B][/COLOR]

In your case the Inner If Statement would look something like:
Code:
[B]Select [COLOR=black]RoundUp ({argReportsEx.WidthImperial},0 )[/COLOR][/B]
    [B]Case[/B] [COLOR=black][B]< 9:[/B][/COLOR]
        [B][COLOR=black]8[/COLOR][/B]
 
    [B]Case[/B] [B]< 10:
        [/B][B]9[/B]
[B].[/B]
[B].[/B]   [B]{The r[COLOR=black]est of the Cases go here[/COLOR]}[/B]
[B].[/B]
    [COLOR=black][B]Default[/B][/COLOR][B]:[/B]
       [B]30[/B]
 

Users who are viewing this thread

Back
Top Bottom