Field Reference and Flowfield

trulyjackytrulyjacky Member Posts: 24
edited 2004-03-23 in Navision Attain
Hi,

I am using FieldRef.CLASS to decide the type of a certain field. But the compiler will complain something like FieldClass <>Option.....

For example:
IF "RecRef".CLASS = "RecRef".CLASS::Flowfield THEN
  "RecRef".CALCFIELD;
Is there any syntax error here? :?

Comments

  • kinekine Member Posts: 12,562
    Class is not option, it is CODE (or Text)
    IF "RecRef".CLASS = 'FLOWFIELD' THEN
      "RecRef".CALCFIELD; 
    

    or something else... :wink:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • trulyjackytrulyjacky Member Posts: 24
    No, Kine, I cannot agree with you on this point. :( Look at the online help:

    CLASS (FieldRef)
    Use this function to return the fieldclass of the field that is currently selected. This function returns an error if no field is selected.

    Class := FieldRef.CLASS

    Class

    Data type: option

    The return vale. The fieldclass of the field.

    FieldRef

    Data type: fieldref

    The fieldref that refers to the field that you are interested in.
  • kinekine Member Posts: 12,562
    Oh... sorry. I it was for FieldRef.Type... :oops:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • kinekine Member Posts: 12,562
    It seems that it's bug (one yeart old, but answer is not accessible for me) - but there is workaround>
    IF FORMAT("RecRef".CLASS) = 'FlowField' THEN
      "RecRef".CALCFIELD; 
    
    :D
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • trulyjackytrulyjacky Member Posts: 24
    You are genius Kine. This is good workaround. Thanx a lot! :P
  • eromeineromein Member Posts: 589
    Maybe (just maybe) it's wise the do something like this:
    IF UPPERCASE(FORMAT("RecRef".CLASS)) = 'FLOWFIELD' THEN 
      "RecRef".CALCFIELD;
    
    "Real programmers don't comment their code.
    If it was hard to write, it should be hard to understand."
Sign In or Register to comment.