Problem with RAP when some fields do not exist...
Hello,
we have the following problem with RAP:
there are 2 versions of our application -> 2 versions of reports. on
updating we have to replace some fields in RAP in the old reports with
fields from the new reports. some fields do not exist in the new
pipeline anymore! -> these fields cannot be replaced. For example the
field myPipeLine['xxx'] does not exist.
the following RAP-Code doesn't matter:
if myPipeLine['xxx'] > 0 then begin
...
...
end;
but with the following RAP-Code there is an conversion-error on
PrintToDevices:
Label1.Caption := FormatFloat('#,##0.00', myPipeLine['aValidField'] +
myPipeLine['aValidField1']);
Label2.Caption := FormatFloat('#,##0.00', myPipeLine['xxx'] +
myPipeLine['aValidField2']); <-- error
Label3.Caption := FormatFloat('#,##0.00', myPipeLine['aValidField'] +
myPipeLine['aValidField3']);
with checking for errors (both examples) with
----------
if raCodMod.raGetCodeModule(MyppReport).Programs[i].SyntaxError then begin
...
end;
---------
this problem can't be determined!
How can I validate the RAP-Code?
Regards,
Dmitri
we have the following problem with RAP:
there are 2 versions of our application -> 2 versions of reports. on
updating we have to replace some fields in RAP in the old reports with
fields from the new reports. some fields do not exist in the new
pipeline anymore! -> these fields cannot be replaced. For example the
field myPipeLine['xxx'] does not exist.
the following RAP-Code doesn't matter:
if myPipeLine['xxx'] > 0 then begin
...
...
end;
but with the following RAP-Code there is an conversion-error on
PrintToDevices:
Label1.Caption := FormatFloat('#,##0.00', myPipeLine['aValidField'] +
myPipeLine['aValidField1']);
Label2.Caption := FormatFloat('#,##0.00', myPipeLine['xxx'] +
myPipeLine['aValidField2']); <-- error
Label3.Caption := FormatFloat('#,##0.00', myPipeLine['aValidField'] +
myPipeLine['aValidField3']);
with checking for errors (both examples) with
----------
if raCodMod.raGetCodeModule(MyppReport).Programs[i].SyntaxError then begin
...
end;
---------
this problem can't be determined!
How can I validate the RAP-Code?
Regards,
Dmitri
This discussion has been closed.
Comments
1. If the field 'xxx' does not exist then a statement such as
myPipeLine['xxx']
will return null. Thus when used in a boolean expression it is evaluating
to false, but when used in an arithmetic expression is resulting in a
conversion error.
3. You could recode the RAP to check whether a value is null
if myPipeline['xxx'] = null then
{field values is null}
or you can check whether a field exists
if customer.FieldObjects['xxx'] = nil then
{field does not exist}
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
some different fieldnames, that could not exist. To check each of these
fields is very "difficult".
Is there no possibility to check a _complete_ rap-program for errors
(like checking for sysntaxerrors)?
Dmitri
RAP has no way to check for this type of error. This an example of a
run-time error, it is not a syntax error.r.
The syntax, myPipeline['xxx'], is correct. At run-time the statement
executes and resolves to Null. Which is also is not an error. The run-time
error occurs when Null is used in the arithmetic expression.
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
this helped me a bit, but what about report objects, which are mentioned in
RAP (something like if ... then DBText1.Visible := true;), but got deleted
by the user? The code can't be executed then. Is there a way to create a RAP
code, which does the same (setting an obkect to visible), which would work
also after the object got deleted?
Such cases happen often on the side of the EndUser and it usualy breaks the
report, since the object is gone, but is still being used in RAP.
What can be done about it?
Regards,
Mark
RAP functions similar to the Delphi IDE. If you delete a component from a
form that contains corresponding references in Delphi code, you will receive
a compilation error. One option would be to quickly check your RAP code
each time a component is deleted to be sure it is not being used in RAP.
Then you could either warn the user or remove the reference yourself.
http://www.digital-metaphors.com/rbWiki/RAP/Fundamentals/How_To...Find_Components_With_RAP_Code
http://www.digital-metaphors.com/rbWiki/RAP/Fundamentals/How_To...Modify_RAP_Programs_in_Code
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com