Include file

asereb

New Member
I stored table field names in the separate table with structure
like:
FIELD field-name AS CHAR
FIELD field-value AS CHAR

Now, I need assign value to the field, which name is stored in
the table above in field-name, to the value that stored in the
column field-value.

I think the best way to do it with include files but not sure how?

Appreciate a lot for any help,

Thank you,
Alex
 

bendaluz2

Member
how do you know which record in the table you are going to update? Or, do you want to create a new record for each entry in the table?
 

sanderpham

New Member
Hi Alex,

I guess you are dealing with the following;

You have two tables; table A and B, A contains the following fields: 'field-name' and 'field-value'.
And table B is for example the table where you store customer records.
Table A will have some records, to the value of field 'field-name' you assigned a particular fieldname which exists in table B.

Then you have a program in which you are looping throug the records in table A and during that loop, you would like to assign values to fields in table B, using A.Field-name. Right?

If this is the case, the following example can be usefull:

DEFINE VARIABLE bfxTableB AS HANDLE NO-UNDO.
DEFINE VARIABLE hxField AS HANDLE NO-UNDO.

FIND FIRST TableB ....... EXCLUSIVE-LOCK NO-WAIT NO-ERROR.
...
bfxTableB = BUFFER Table-B:HANDLE.

FOR EACH TableA no-lock:
hxField = bfxTableB:BUFFER-FIELD(TableA.field-name).
hxField:BUFFER-VALUE = TableA.field-value.
END.

.....


Hope this solves your issue.



Sander






Note: edit it to your flavor, this is just a very basic example
 
Top