• Error with result.sort()

    By Simon Moullin 1 decade ago

    Hello,

    I have a test setup with a single server profile.  When trying to open the profile in the web interface I get an error in ccServerProfileDialogContents.xsp

    After creating a second server profile the function works.  It appears to be the at the line "var result = @Unique(@Trim(@List(x,y)));" returns a string and not an array when there is a single document.

    Unexpected runtime error

    The runtime has encountered an unexpected error.

    Error source

    Page Name:/DominoDefrag.xsp
    Control Id: selectItems1
     

    Exception

    Error while executing JavaScript computed expression
    Script interpreter error, line=5, col=8: [TypeError] Error calling method 'sort()' on an object of type 'String [JavaScript Object]'

    JavaScript code

       1: var x = @DbColumn(@DbName(), "Servers", 1);
       2: var dbname = new Array(session.getServerName(),"names.nsf");
       3: var y = @Name("[ABBREVIATE]",@DbColumn(dbname,"($Servers)",1)); 
       4: var result = @Unique(@Trim(@List(x,y)));
       5: result.sort();
    

     

     Stack Trace

    • result.sort() fix . Can you please test too

      By Andrew Luder 1 decade ago

      Hi Simon,thank you very much :) . will update code in next couple of days. Before to verify could you please

      replace result.sort() line in ccServerProfileDialogContents and ccDojoGrid and test as well

                                 if(@Elements(result) > 1)
                                  {    
                                          result.sort();
                                 }
                                  else
                                 {
                                        result;
                                 }

      • That works

        By Simon Moullin 1 decade ago

        That seems to do it.  Thank you