Hi Experts,
In a record variable, how can i check for Field no. that exist in the Record Variable or not... Dynamically i want to pass the Field Name to the Record Variable say.. Customer No. and get the Field No. from that Customer table.
When i pass the variable like this...
E.g.
FName := 'Name';
FieldNo := Customer.FieldName(FName);
It says error...i might be wrong.. but i don't know how to give the syntax for this...i need to pass parameters as a text variable(of Field Name) dynamically...and fetch the Field No. from Customer Table...
Any one has any idea about this....please...
Thanks...
Thanks & Regards...
Suba
0
Comments
anyway, FIELDNAME function doesn't work like this read the online help. This function is useless for your purpose :roll:
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
I have used the Field table only for values from a Field Name... My query is whether dynamically get the field no. when i pass the field Name as a string....??
Thanks...
Suba
if you just have the field name as a string, you have to filter the table for table no. and field name, then do a findfirst and you got the field no.
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
In RecordRef, my code is...
MField.RESET;
MField.SETCURRENTKEY(TableNo,"No.");
MField.SETRANGE(TableNo,18);
MField.SETRANGE("No.",2);
IF MField.FIND('-') THEN
REPEAT
RecRef.OPEN(MField.TableNo);
IF RecRef.FIND('-') THEN
REPEAT
FldRef := RecRef.FIELD(MField."No."); //Pass the Field Nos. to get the value
IF Customer.Name = FORMAT(FldRef.VALUE) THEN BEGIN
message(FORMAT(FldRef.VALUE));
END;
until recref.next = 0;
RecRef.CLOSE;
In this code, i have highlighted a place where i want to compare the text field where i have the Field Name...
So how to compare the String which holds Field Name against the value...
can i convert the String into an executable code???
Suba
Here's an example of how you could create a '''dynamic''' match finder by using just
the Table-ID and two field names as parameters.
Be aware that this code is without checks on the returned Field-ID. You could easily add some code to check
the returned field id first.
Regards, Bart