Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xpages @IsMember function in dialog list item values

Tags:

xpages

Based on this XPages adding @Formulas in dialogList, my dialogList1 takes values from two concatenated views: a and b.

There is another dialogList2, which is rendered depending if the dialogList1 value is null or not, whose values should be like this:

dialogList1.value is from a => dialogList2.choices should be only from b

dialogList1.value is from b => dialogList2.choices should be only from a

I tried:

// Contr.txt_particontractcv_1 - is the value binded by dialogList1    
var dbname = session.getServerName() + "!!" + "mynsf.nsf";

    //var a = @Unique(@DbColumn(dbname, "vwNumeCompanii", 0)).sort();
    //var b = @Unique(@DbColumn(@DbName(),"vwA",0));

    //return a.concat(b);
    if ( @IsMember(Contr.txt_particontractcv_1,@Unique(@DbColumn(@DbName(),"vwA",0))))
    { return @Unique(@DbColumn(dbname, "vwNumeCompanii", 0)) }

    else 
    { return @Unique(@DbColumn(@DbName(),"vwA",0)) }

but the dialogList2 is taking values only from vwA ( from b ) ... I think I'm missing something. Thanks for your time.

like image 696
Florin M. Avatar asked Sep 04 '14 11:09

Florin M.


2 Answers

Contr.txt_particontractcv_1 cannot be used in SSJS. Dot notation works in LotusScript but not SSJS or Java because Java's runtime is not proprietary and has not been extended that way. That is why Contr.getItemValueString("txt_particontractcv_1") is required.

Some SSJS global variables allow dot notation to be used, e.g. sessionScope. But that is because it is based on a Map, so sessionScope.myProperty can only map to sessionScope.get("myProperty"). The Domino Document class does not extend the Map interface (that's one of the enhancements of the OpenNTF Domino API), so dot notation doesn't know whether to use getItemValue(), getItemValueString(), getItemValueDateTimeArray() etc.

This is also why best practice for scoped variables is also to use e.g. sessionScope.get("myVar"). When it comes to moving to Java, you will not be able to use dot notation, you will have to use the relevant method. So working that way in SSJS fosters good habits for the future.

like image 151
Paul Stephen Withers Avatar answered Oct 18 '22 21:10

Paul Stephen Withers


Yep, I just modified Contr.txt_particontractcv_1 to Contr.getItemValueString("txt_particontractcv_1") and, now, it works.`

like image 2
Florin M. Avatar answered Oct 18 '22 20:10

Florin M.