VARIABLEACTIVE in 2009 RTC or webservices

ara3nara3n Member Posts: 9,256
edited 2009-06-03 in NAV Three Tier
Hello

Client is upgrading and one of their modification is using the VARIABLEACTIVE(RecordRef) .


When calling this from webservice they get the following error.
<faultcode xmlns:a="urn:microsoft-dynamics-schemas/error">a:Microsoft.Dynamics.Nav.Types.Exceptions.NavObsoleteMethodException</faultcode> 
<faultstring xml:lang="en-US">The VARIABLEACTIVE() method is obsolete.</faultstring>
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">The VARIABLEACTIVE() method is obsolete.</string> 


I have not used VARIABLEACTIVE ever in my code ever.
The documentation is slim
Use this function to determine if a variable, such as field or a control, is active or inactive.


So the question is what is the substitute for this function that is obsolete in 3 tiered 2009.
I didn't see anywhere in documentation that this function was obsolete.
Ahmed Rashed Amini
Independent Consultant/Developer


blog: https://dynamicsuser.net/nav/b/ara3n

Comments

  • kinekine Member Posts: 12,562
    May be you can compare some part of the RecordRef which must be set to be active, e.g. tableno or something... all depends on the meaning in the code where it is used...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ara3nara3n Member Posts: 9,256
    The code is called in a function
    CheckOnModify(RecordRef)
    
    if not VARIABLEACTIVE(RecordRef) then
     exit;
    


    The function is called from CU 1 onglobalModify trigger.


    I'm simplifying this and I'm sure the function is called other ways. So how can I check that a recordref is initialized?


    I guess I could format(recref) = '' then it's not initialized?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • kinekine Member Posts: 12,562
    Yes, you could try it, it will be empty if not active, else it return something...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ara3nara3n Member Posts: 9,256
    I'm hoping to see if somebody from MS answers this.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • dmccraedmccrae Member, Microsoft Employee Posts: 144
    In the case of RecordRef, what you propose with checking the FORMAT string is the only way currently. In 2009 SP1 the NUMBER function will return 0 and this well be a slightly neater test.

    Generally, VARIABLEACTIVE is tied into the AL runtime and when moving to the CLR it simply has no meaning for basic types, although it could have been special-cased for the complex ones. The cleanest handling was to obsolete it totally.

    MSDN has a summary of similarly obsoleted functions or changes in behavior:

    http://msdn.microsoft.com/en-us/library/dd301289.aspx
    Dean McCrae - Senior Software Developer, NAV Server & Tools

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • ara3nara3n Member Posts: 9,256
    Thank you for the info.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.