RAP
I am trying to create tax breakouts with wich the users can create their own
tax calculations. I need to be able to run a calculation such as ((100 +
(100 * 0.0533)) * .035) but not hard coded into a report component. I need
to be able to take the calculation, entered by the user into a character
field in the DB, and set that as the calculation of a variable, then run the
report to return the result of the calculation. Basically is there any way
to set the calculation of a variable component from code? I went to look at
the source code of the rap modules and realized that they are not provided
as part of the full source code.
Thanks All,
Branden
tax calculations. I need to be able to run a calculation such as ((100 +
(100 * 0.0533)) * .035) but not hard coded into a report component. I need
to be able to take the calculation, entered by the user into a character
field in the DB, and set that as the calculation of a variable, then run the
report to return the result of the calculation. Basically is there any way
to set the calculation of a variable component from code? I went to look at
the source code of the rap modules and realized that they are not provided
as part of the full source code.
Thanks All,
Branden
This discussion has been closed.
Comments
Here is an example of programmatically creating a Variable OnCalc
event-handler for RAP.
www.digital-metaphors.com/tips/RAPCreateVariableOnCalcHandler.zip
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Thank You!
Branden Johnson
Integrity Software Design
I did from the example you provided:
lNewEventHandler := lCodeModule.CreateEventHandler(ppVarCalc, 'OnCalc');
{set BodyText to modify the code between the begin..end}
lNewEventHandler.BodyText := 'Value := ' + sTaxCalc + ';';
In this code, ppVarCalc is a variable compnent on the header band of the
report. sTaxCalc is a variable holding the calculation entered by the user
(i.e. ((100 + (100 * 0.0533)) * .035)).
I have no problems with the code, I just need to know what to do from this
point to get the result of the calculation entered...
Thanks All
Branden Johnson
Integrity Software Design
correctly, and display the error message if it did not?
Thanks All
Branden Johnson
Integrity Software Design
OnCalc event-handler will fire and the calculation will be stored to the
Variable.Value and rendered to the output.
I do not understand the question.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
the calculation input by the user. If I could get the calculation to fire
and retrieve the value from code, without running the report, it would be a
major plus! Right now I am running that report and saving to a text file
and am setting a global variable, in code not in report, to the calcs value
in a on get text event for the variable.
Thank Nard,
Branden Johnson
lbCompiled := myProgram.Compile(False, False);
- the Program class a couple of public properties for syntax errors.
property SyntaxErrors[Index: Integer]: TraSyntaxError read
GetSyntaxErrorForIndex;
property SyntaxErrorCount: Integer read GetSyntaxErrorCount;
- the TraSyntaxError class some public properties containing the location
of the error and the message.
property CharPos: Integer read FCharPos write FCharPos;
property LineNo: Integer read FLineNo write FLineNo;
property Msg: String read FMsg write FMsg;
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
RAP was not designed to be used without running the report. A Variable
OnCalc event-handler typically fires when the report is generating.
That being said, I was able to create an example that you can download. The
example shows how to create and execute a RAP global function that adds two
numbers and returns the result.
www.digital-metaphors.com/tips/RapCreateGlobalFunctionandExecute.zip
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
That was also exactly what I was looking for. The intricacies and
abilities of Report Builder never cease to amaze me. You have an incredible
product and impeccable support!
Thanks Again,
Branden Johnson
Integrity Software Design