Error when adding a new company

elwin68elwin68 Member Posts: 153
An error occures when doing the following:
- Open a standard CRONUS database in Navision 5.0 SP1
- Create a new company
- Select a company type
- After clicking Ok data will be imported and applied
- When applying data the following error occures:
The value General,Sales,Purchaes,Cash Receipts,
Payments,Assets,Intercompany,Jobs,,,,Cash,Bank for
SELECTSTR parameter no. 2 is not valid.

This happens at the following line (function Texttooptionvalue in codeunit 5302) when counter has the value 9:
IF UPPERCASE(SELECTSTR(Counter,OptionString)) = UPPERCASE(InputText) THEN

Is there a fix for this?

Thanks in advance.

Answers

  • imurphyimurphy Member Posts: 308
    just tried exactly the same thing and didn't get any problems, so maybe a problem with the Dutch localised version?

    Anyone in the netherlands able to try this out?

    Ian
  • elwin68elwin68 Member Posts: 153
    I have changed the language to english to but with the same error.
  • imurphyimurphy Member Posts: 308
    In each country the Cronus Db is slightly different. The Db format is the same but the codebase used is different. As a consequence the code it executes to create a new company in your Cronus is different from the code it executes in mine - or at least there are some small differences.

    Ian
  • SilverXSilverX Member Posts: 134
    Try to change the following code in CU 5302, function EvaluateTextToFieldRef():
    EVALUATE(Field.Type,FORMAT(FieldRef.TYPE));
    CASE Field.Type OF
      Field.Type::Option:
        BEGIN
          IntVar := TextToOptionValue(InputText,FieldRef.OPTIONCAPTION);
          IF IntVar = -1 THEN
            EXIT(FALSE);
    

    to
    EVALUATE(Field.Type,FORMAT(FieldRef.TYPE));
    CASE Field.Type OF
      Field.Type::Option:
        BEGIN
          IntVar := TextToOptionValue(InputText,ReplaceText(FieldRef.OPTIONCAPTION, ',,', ', ,', FALSE));
          IF IntVar = -1 THEN
            EXIT(FALSE);
    

    SELECTSTR() does not work correctly with empty options. Seems like you have some empty ("Opt1,Opt2,,Opt4") option values. It's the same with the german version.

    Not checked if it works with multiple missing values.
    Cheers
    Carsten


    ==> How To Ask Questions The Smart Way

    This post is my own opinion and does not necessarily reflect the opinion or view of my employer.
  • elwin68elwin68 Member Posts: 153
    Thanks for your answer.
    The solution doesn't work because a option value may occure just 1 time.
    The following code can help with this:


    Field.Type::Option:
    BEGIN
    OptionText := FieldRef.OPTIONCAPTION;
    OptionValue := 0;
    WHILE STRPOS(OptionText,',,') > 0 DO BEGIN
    OptionValue := OptionValue + 1;
    OptionText := INSSTR(OptionText,FORMAT(OptionValue),
    STRPOS(OptionText,',,')+1);
    END;
    IntVar := TextToOptionValue(InputText,OptionText);
    IF IntVar = -1 THEN
    EXIT(FALSE);
  • mgmmgm Member Posts: 126
    Problem is in Dutch localization indeed.
    Error occurs when importing the XML with defaults. Nav is creating Gen. Journal Templates. The XML is not specific dutch, the code in Table 80 is.
    Field Type in Table 80 has the following Option String:

    General,Sales,Purchases,Cash Receipts,Payments,Assets,Intercompany,Jobs,,,,Cash,Bank

    The string ",,,,Cash,Bank" is added.
    Do not change the Option Sting! This will give errors in other places of the application.
    Try to us the following temp workaround:

    Add code to Codeunit 5302 temporary.

    TextToOptionValue(InputText : Text[1024];OptionString : Text[1024]) : Integer
    IF InputText = '' THEN
      InputText := ' ';
    
    // >>
    IF STRPOS(OptionString,',,') <> 0 THEN BEGIN
      FOR Counter := 1 TO STRLEN(OptionString) DO
        IF STRPOS(OptionString,',,') <> 0 THEN
          OptionString := INSSTR(OptionString,FORMAT(Counter),STRPOS(OptionString,',,') + 1);
    //  IF NOT CONFIRM('OptionString: %1\\Continue?',TRUE,OptionString) THEN
    //    ERROR('');
    END;
    // <<
    


    This seems like a bug for the Microsoft Team to me!
Sign In or Register to comment.