Page 1 of 1

Include statement

PostPosted: Thu Jul 29, 2010 11:19 am
by Arkantos
Hi,

I tried to create a dynamic include statement like,

INCLUDE READ-C '#FILE-NAME' '#FILE-KEY' '#FIELD-VALUE' .

But im getting NAT0274 Error 623 in line 20 of copycode.

READ-C :

0010 *
0020 READ &1& BY &2& EQ '&3&'
0030 *
0040 IF &2& NE &3&
0050 ESCAPE BOTTOM
0060 END-IF
0080 *
0090 END-READ

But if i use

INCLUDE READ-C 'EMPLOYEE' 'EMPLOYEE-NAME' '#FIELD-VALUE'

im not getting any error.

Cant we create a dynamic input field like #FILE-NAME while using a copycode ?

Regards
Arkantos

Re: Include statement

PostPosted: Thu Jul 29, 2010 1:20 pm
by RGZbrog
After the compiler has replaced the tags with the supplied values, the result must be valid Natural source code.

The second example works because EMPLOYEE is a valid view name. The first example fails because there is no such view as #FILE-NAME.

The syntax of a READ statement requires a view name, as in READ view. The view cannot be specified as the contents of a variable, what you refer to as a "dynamic input field." You would have to know all the view names and code something like

DECIDE FOR FIRST CONDITION
  WHEN something
       INCLUDE READ-C 'EMPLOYEE' ...
  WHEN something-else
       INCLUDE READ-C 'VEHICLE' ...

Re: Include statement

PostPosted: Thu Jul 29, 2010 2:54 pm
by Arkantos
Thanks RGZbrog .