Delen via


RIM Tool on NAV 2009

With the release of 5.0 SP1, a new data type conversion routine was introduced with codeunit 5302 - Outlook Synch. Type Conversion. There are several known issues with data migration due to these changes.

The previously published blog for 5.0 SP1 contains a change log of some code suggestions and workarounds for the more common and/or critical issues. 

This blog addresses many of the same issues in NAV 2009. While some corrections were made between the release of 5.0 SP1 and 2009, not all fixes made it into the RTM release of 2009. The following change log can be applied to the 2009 objects.

This change log applies to 2009 RTM application objects ONLY.

Issues addressed by the change log:

1) Overflow on type conversion from Text to Text in Form 8626 when a text field larger than 100 chars is imported.
2) Error on import of fields beginning with a number -1099 Code, etc.- The call to member selectSingleNode failed. msxml6.dll returned the
   following message: Expression must evaluate to a node-set.
3) Imported dates are blank after migration data is applied.
4) Negative decimal values are converted incorrectly, resulting in changed values.
5) Expected token 'EOF' found '$'. Error on fields with $ symbol

Changes are labeled with the associated number above.

 

Form 8626 Migration Records

---------------------------

Before:

CODE

  {

    VAR

      MatrixColumnCaptions@1000 : ARRAY [100] OF Text[100];

      MigrationData@1001 : Record 8615;

      MatrixCellData@1002 : ARRAY [100] OF Text[100];

      MigrationColumnField@1004 : ARRAY [100] OF Integer;

      MatrixColumnOrdinal@1003 : Integer;

      FormCaption@1005 : Text[1024];

      TableNo@1006 : Integer;

      Text001@1007 : TextConst 'ENU=%1 value ''%2'' does not exist.';

After:

CODE

  {

  VAR

      MatrixColumnCaptions@1000 : ARRAY [100] OF Text[100];

      MigrationData@1001 : Record 8615;

      MatrixCellData@1002 : ARRAY [100] OF Text[250]; // changed #1 - changed from Text[100] to Text[250]

      MigrationColumnField@1004 : ARRAY [100] OF Integer;

      MatrixColumnOrdinal@1003 : Integer;

      FormCaption@1005 : Text[1024];

      TableNo@1006 : Integer;

      Text001@1007 : TextConst 'ENU=%1 value ''%2'' does not exist.';

* XMLport 8610 - Setup DataSchema

---------------------------------

...

NameIn := DELCHR(NameIn,'=','Ù''`');

NameIn := DELCHR(CONVERTSTR(NameIn,'<>,./\+-&()%',' '),'=',' ');

NameIn := DELCHR(NameIn,'=',' ');

EXIT(NameIn);

...

After:

...

NameIn := DELCHR(NameIn,'=','Ù''`');

NameIn := DELCHR(CONVERTSTR(NameIn,'<>,./\+-&()%$',' '),'=',' '); // Changed - added $ symbol and one additional space between single quotes #5

NameIn := DELCHR(NameIn,'=',' ');

IF (NameIn[1] >= '0') AND (NameIn[1] <= '9') THEN // Added #2

  NameIn := '_' + NameIn; // Added #2

EXIT(NameIn);

* Codeunit 8611\Function FieldNodeExists ...

--------------------------------------------

Before:

FieldNode := RecordNode.selectSingleNode(FieldNodeName);

IF NOT ISCLEAR(FieldNode) THEN

  EXIT(TRUE);

After:

IF (FieldNodeName[1] >= '0') AND (FieldNodeName[1] <= '9') THEN // Added #2

  FieldNodeName := '_' + FieldNodeName; // Added #2

FieldNode := RecordNode.selectSingleNode(FieldNodeName);

IF NOT ISCLEAR(FieldNode) THEN

  EXIT(TRUE);

* Codeunit 8611, Function GetElementName

----------------------------------------

Before:

...

NameIn := DELCHR(NameIn,'=','Ù''`');

NameIn := DELCHR(CONVERTSTR(NameIn,'<>,./\+-&()%',' '),'=',' ');

NameIn := DELCHR(NameIn,'=',' ');

EXIT(NameIn);

...

After:

...

NameIn := DELCHR(NameIn,'=','Ù''`');

NameIn := DELCHR(CONVERTSTR(NameIn,'<>,./\+-&()%$',' '),'=',' '); //Changed - added $ symbol and one additional space between single quotes #5

NameIn := DELCHR(NameIn,'=',' ');

IF (NameIn[1] >= '0') AND (NameIn[1] <= '9') THEN // Added #2

  NameIn := '_' + NameIn; // Added #2

EXIT(NameIn);

* Codeunit 8611, Function InsertRecordWithKeyFields

-----------------------------------------------------

Before:

VAR

      MatrixData@1001 : Record 8615;

      MigrationTableField@1007 : Record 8616;

      OSynchTypeConversion@1008 : Codeunit 5302;

      RecRef1@1006 : RecordRef;

      KeyRef@1003 : KeyRef;

      FieldRef@1004 : FieldRef;

      KeyFieldCount@1005 : Integer;

      ToValidate@1009 : Boolean;

    BEGIN

      MatrixData.SETRANGE(TableID,MatrixRecord.TableID);

      MatrixData.SETRANGE("No.",MatrixRecord."No.");

      KeyRef := RecRef.KEYINDEX(1);

      FOR KeyFieldCount := 1 TO KeyRef.FIELDCOUNT DO BEGIN

        FieldRef := KeyRef.FIELDINDEX(KeyFieldCount);

        ValidationFieldID := FieldRef.NUMBER;

        MatrixData.SETRANGE(FieldID,FieldRef.NUMBER);

        IF MatrixData.FIND('-') THEN BEGIN

          MigrationTableField.GET(MatrixData.TableID,MatrixData.FieldID);

          ToValidate := MigrationTableField.Validate AND NOT TestRelation(FieldRef);

          OSynchTypeConversion.EvaluateTextToFieldRef(MatrixData.Value,FieldRef,ToValidate);

        END ELSE

          IF KeyRef.FIELDCOUNT <> 1 THEN BEGIN

            ERROR(STRSUBSTNO(Text000,FieldRef.NAME,RecRef.NAME + ':' + FORMAT(MatrixData."No.")));

          END

      END;

      RecRef1 := RecRef.DUPLICATE;

      IF RecRef1.FIND('=') THEN BEGIN

        RecRef := RecRef1;

        EXIT

      END;

      RecRef.INSERT(NOT CompanySetupRun);

    END;

After:

VAR

      MatrixData@1001 : Record 8615;

      MigrationTableField@1007 : Record 8616;

      OSynchTypeConversion@1008 : Codeunit 5302;

      RecRef1@1006 : RecordRef;

      KeyRef@1003 : KeyRef;

      FieldRef@1004 : FieldRef;

      KeyFieldCount@1005 : Integer;

      ToValidate@1009 : Boolean;

      Field@1010 : Record 2000000041; // Added #3

      Datevalue@1011 : Date; // Added #3

   BEGIN

      MatrixData.SETRANGE(TableID,MatrixRecord.TableID);

      MatrixData.SETRANGE("No.",MatrixRecord."No.");

      KeyRef := RecRef.KEYINDEX(1);

      FOR KeyFieldCount := 1 TO KeyRef.FIELDCOUNT DO BEGIN

        FieldRef := KeyRef.FIELDINDEX(KeyFieldCount);

        ValidationFieldID := FieldRef.NUMBER;

        MatrixData.SETRANGE(FieldID,FieldRef.NUMBER);

        IF MatrixData.FIND('-') THEN BEGIN

          MigrationTableField.GET(MatrixData.TableID,MatrixData.FieldID);

          ToValidate := MigrationTableField.Validate AND NOT TestRelation(FieldRef);

          //OSynchTypeConversion.EvaluateTextToFieldRef(MatrixData.Value,FieldRef,ToValidate); // removed #3

          Field.GET(RecRef.NUMBER, FieldRef.NUMBER); // Added #3

          IF Field.Type <> Field.Type::Date THEN // Added #3

            OSynchTypeConversion.EvaluateTextToFieldRef(MatrixData.Value,FieldRef,ToValidate) // Added #3

          ELSE BEGIN // Added #3

            EVALUATE(Datevalue, MatrixData.Value); // Added #3

            FieldRef.VALUE := Datevalue; // Added #3

          END; // Added #3

        END ELSE

          IF KeyRef.FIELDCOUNT <> 1 THEN BEGIN

            ERROR(STRSUBSTNO(Text000,FieldRef.NAME,RecRef.NAME + ':' + FORMAT(MatrixData."No.")));

          END

      END;

      RecRef1 := RecRef.DUPLICATE;

      IF RecRef1.FIND('=') THEN BEGIN

        RecRef := RecRef1;

        EXIT

      END;

      RecRef.INSERT(NOT CompanySetupRun);

    END;

* Codeunit 8611, Function ModifyRecordWithOtherFields

-----------------------------------------------------

Before:

VAR

      MatrixData@1002 : Record 8615;

      MigrationTableField@1000 : Record 8616;

      Question@1003 : Record 8612;

      Field@1007 : Record 2000000041;

      MigrationTable@1009 : Record 8613;

      DataTemplateHeader@1011 : Record 8618;

      QuestionnaireMgt@1006 : Codeunit 8610;

      TemplateMgt@1012 : Codeunit 8612;

      OSynchTypeConversion@1014 : Codeunit 5302;

      FieldRef@1001 : FieldRef;

      OptionInt@1008 : Integer;

      DateFormula@1010 : DateFormula;

      ToValidate@1013 : Boolean;

After:

 VAR

      MatrixData@1002 : Record 8615;

      MigrationTableField@1000 : Record 8616;

      Question@1003 : Record 8612;

      Field@1007 : Record 2000000041;

      MigrationTable@1009 : Record 8613;

      DataTemplateHeader@1011 : Record 8618;

      QuestionnaireMgt@1006 : Codeunit 8610;

      TemplateMgt@1012 : Codeunit 8612;

      OSynchTypeConversion@1014 : Codeunit 5302;

      FieldRef@1001 : FieldRef;

      OptionInt@1008 : Integer;

      DateFormula@1010 : DateFormula;

      ToValidate@1013 : Boolean;

      DateValue@1500000 : Date; // Added #3

Before:

    IF MigrationTableField.FIND('-') THEN

      IF NOT IsKeyField(MigrationTableField.TableID,MigrationTableField.FieldID) THEN BEGIN

        FieldRef := RecRef.FIELD(MatrixData.FieldID);

        IF CompanySetupRun THEN

          ToValidate:= FALSE

        ELSE

          ToValidate := MigrationTableField.Validate AND NOT TestRelation(FieldRef);

        OSynchTypeConversion.EvaluateTextToFieldRef(MatrixData.Value,FieldRef,ToValidate)

      END;

      IF DataTemplateHeader.GET(MigrationTable."Data Template") THEN

        TemplateMgt.UpdateRecord(DataTemplateHeader,RecRef);

After:

    IF MigrationTableField.FIND('-') THEN

      IF NOT IsKeyField(MigrationTableField.TableID,MigrationTableField.FieldID) THEN BEGIN

        FieldRef := RecRef.FIELD(MatrixData.FieldID);

        IF CompanySetupRun THEN

          ToValidate:= FALSE

        ELSE

          ToValidate := MigrationTableField.Validate AND NOT TestRelation(FieldRef);

        //OSynchTypeConversion.EvaluateTextToFieldRef(MatrixData.Value,FieldRef,ToValidate) // removed #3

        Field.GET(RecRef.NUMBER, FieldRef.NUMBER); // Added #3

        IF Field.Type <> Field.Type::Date THEN // Added #3

          OSynchTypeConversion.EvaluateTextToFieldRef(MatrixData.Value,FieldRef,ToValidate) // Added #3

        ELSE BEGIN // Added #3

          EVALUATE(DateValue, MatrixData.Value); // Added #3

          FieldRef.VALUE := DateValue; // Added #3

        END; // Added #3

      END;

      IF DataTemplateHeader.GET(MigrationTable."Data Template") THEN

        TemplateMgt.UpdateRecord(DataTemplateHeader,RecRef);

 

* Codeunit 5302, Function TextToDecimal

----------------------------------------

Before:

VAR

      PartArray@1003 : ARRAY [2] OF Text[250];

      IntegeralPart@1001 : Integer;

      FractionalPart@1002 : Integer;

After:

VAR

      PartArray@1003 : ARRAY [2] OF Text[250];

      IntegeralPart@1001 : Integer;

      FractionalPart@1002 : Integer;

      Sign@1005 : Integer; //add new local variable #4

Before:

DecVar := IntegeralPart + (FractionalPart / POWER(10,STRLEN(PartArray[2])));

After:

IF STRPOS(InputText,'-') = 0 THEN //added #4

  Sign := 1 //added #4

ELSE //added #4

  Sign := -1; //added #4

DecVar := (Sign * (ABS(IntegeralPart) + (FractionalPart / POWER(10,STRLEN(PartArray[2]))))); //changed #4

 

Laura K. Lake

Microsoft Dynamics NA

Microsoft Customer Service and Support (CSS) North America

These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.