Current Field ID

Does anyone know of a function to return the current field number? I know the function rec.FIELDNO - why doesn’t it just do this Here is what I want to do:

CASE **CurrentFieldNo** OF
   Customer.FIELDNO("No."): ...
   Customer.FIELDNO(Name): ...
   Customer.FIELDNO(Address): ...
   ELSE ...

And what I need is of cause CurrentFieldNo… Best regards, Erik P. Ernst, webmaster

Check tables, there are var CurrFieldNo. It works only in tables.

Thanks. I know about this variable, but I need it from a form Best regards, Erik P. Ernst, webmaster

Could you try writing a function within the table that checks and can be called from the form? Regards! Kristopher Webb Kelar Corporation, Canada

Erik - What exactly are You trying to do??? You might be able to use ‘Active’

Case true of
  CurrForm."Customer No.".Active : message('The Customer No. Field is active');
  CurrForm."Item No.".Active : message('The Item No. Field is active');

//Henrik Helgesen -: KISS::Keep it Simple, Stupid :-

I’m trying to create a form that calls a function (codeunit) with only the call to the function and no parameters. This call must be inserted on all fields on the form in the OnAfterValidate trigger. Therefor I would like it NOT to have any parameters - or eventually just have the Current Field ID or Current Control ID as the parameter, because it then can be inserted more easily. Best regards, Erik P. Ernst, webmaster

I’m not really sure if this saves any work, but… On the table, create a new function GetCurrFieldNo returning an integer and set the code as EXIT(CurrFieldNo); Now, on the OnAfterValidate trigger, you can call your function with GetCurrFieldNo as a parameter. Or for testing MESSAGE(’%1’,GetCurrFieldNo); Now the catch… For CurrFieldNo on the table to have the correct value, there has to be code in the OnValidate trigger for the field. This includes just a comment line. Hope this helps. Whether is it worth the time/effort is a different story. Sometimes Navision lets us do difficult things very easily, but other times something that sounds simple is near impossible. :slight_smile: Chris Krantz NCSD,NCSQL,MCSD,MCSE Microforum Inc. Toronto, Ontario, Canada