Xpages adding @formula to the list

There is a client note application and in its main form there is a dialog box with this formula: (C21331: 312321C is, in fact, the replica identifier, in this example it is just a random number)

_view := "vw1"; _vieww :="vw1"; x : =@Sort (@Unique ( @DbColumn( "" : "NoCache" ; C21331:312321C; _view; 1 ) );[Ascending]); y : =@Unique ( @DbColumn( "" : "NoCache" ; @DbName ; _vieww ; 1)); y:x 

How to use the above code in my calculated combobox values? I tried:

  var _view = "vw1"; var _vieww= "vw2"; db = new Array(@Sort(@Unique ( @DbColumn( "" : "NoCache" , C21331:312321C, _view, 1 ) );[Ascending]); db1 = new Array(@Unique ( @DbColumn( "" : "NoCache" ; @DbName ; _vieww ; 1))); db:db1 

How can I achieve this function in xpages? Thank you for your time.

+3
source share
1 answer

Use .sort() to sort the array (@Sort is not implemented in SSJS) and .concat() to combine two arrays or an array and a string:

 var a = [].concat(@Unique(@DbColumn( ... ))).sort(); var b = @Unique(@DbColumn( ... )); return a.concat(b); 
+4
source

Source: https://habr.com/ru/post/1201812/


All Articles