ListBox Multi-Value String to Object - xpages

I have a ListBox where I need to restrict the number of options selected to two. I'm using 8.5.2 so cannot use the SSJS custom validator, but I can use a Java validator. The Java validator received the submittedValue as a comma-separated String.
The problem occurs if a value contains a comma. In that case, if I split the submittedValue String on commas, my code will think more options have been selected than actually have been.
When the value is written back into the underlying Notes Document, the conversion to getValue() has correctly mapped values. So if getSubmittedValue() was a single option from the ListBox that contained a comma, getValue() gives me a single element rather than two elements.
My query is how to reproduce the getSubmittedValue() to getValue() conversion, to correctly work out how many options have been selected.

Paul, you actually can control the commas. The option has a display string and a value. You could substitute the comma for e.g. # and later before saving it back check if you have a # at the same position the display values have a , and save it then.
It's a lot more work - so not smart.
The other option: take the possible values out one by one:
sort them by size, longest first (this way you avoid having a value that is contained in another value to screw up (e.g. "Red boat" vs "boat"
take them out of the return string (if removal worked, then you have one, stop when you hit the 3rd)
.... but probably the easiest on is to do that in a little client side JavaScript counting the checked=checked values

Related

Modify Lee Mac's Length and Area Field to automatically copy the outputted length to clipboad

I'm using Lee Mac's length and area field to automatically get the total length of an object.
I'm a complete beginner on AutoLisp so I cant find the variable responsible on holding the total length so I can put it in my snippet code to automatically copy it on my clipboard for easy pasting on excel.
Here's my code snippet for automatically putting it to clipboard
(vlax-invoke
(vlax-get (vlax-get (vlax-create-object "htmlfile") 'ParentWindow) 'ClipBoardData)
'setData
"TEXT"
(getvar
)
Since my application uses AutoCAD field expressions to output the length and/or area, the length & area values are not stored in any variable in the code; furthermore, the resulting values displayed by the selected annotation object (which may also be converted to other units and formatted by the field expression) are only available after the field expression has been evaluated.
Given the above, you would need to obtain the text content of the object selected for output after it has been populated with the field expression, before copying such content to the Windows clipboard.
This would involve modifying every branch of my LM:outputtext function to assign the result of evaluating the field expression to a variable which may then be returned by the function and used by the calling function.

How to include a dash(-) character in the Natural key

A custom DAC has a PK that is 10 characters length. The characters include a dash. Example: 10-117ASKP. I notice that it's not possible to type the dash character, in the UI. So I'm unable to assign the value. I added the correct value directly in the database table. The record is saved, but the UI shows the value without the dash. How to accomplish the goal?

how to get all values from dropdown from web application in blueprism

I want get all values of dropdown and want to store them somewhere. from follwing NASDAQ site https://www.nasdaq.com/symbol/ge/historical i want get all values of Timeframe and want to somewhere so that i can use those values one b one in loop and get the values of stock for all timeframe. Click below image screenshot
It's not that easy to get each of the values, but it's not impossible. First you can get all the values in a Data Item as text. If you spy the element, you will notice that the attribute Value contains what you want. So you will need to use a read stage and get this specific attribute's value (you can ignore the PDF elements):
Doing so will give you the following:
The problem with this is that you cannot use this in a loop. One way around would be to split on space:
And the resulting collection (I called it Split Values) will look like this:
But it's not quite there yet. You should however be able to use this collection to get the collection you need (or use it directly).
If you use it directly, I would say it should look like this:
Empty? has the expression [Split Values.words]="" (notice the last row is blank)
Value is number has the expression IsNumber([Split Values.words])
Set Current Item as Number has expression [Split Values.words] with store value Current Item.
Append word to Current Item has expression [Current Item]&" "&[Split Values.words] with store value Current Item.

Primefaces InputMask optional digits

I'm working on a small Project using Primefaces.
I'm trying to display value from my database with special formation
I store a String in my database which Looks like this 40;99;1;0;0;12
These are six different numbers seperated with a ;and they have a range between 0-99.
I want to display this value in an InputMask to make sure that the user doesn't forget the ;.
Now I have a problem with the format.
I'm using this
<p:inputMask id="myID" placeholder="Value" value="#{myClass.value}" mask="9?9;99;99;99;99;99"/>
I'm trying to say that the mask contains six "fields" for a number input and each field can contain a number between 1-99.
The problem is if the user writes the input as this 30;10;0_;0_;0_;4_Primefaces converts it to 30;10;00;04;__;_
Is there a good way to let the mask know that it can be a number with one or two digits?
Or is there a way to say, if input has just one digit put a 0 first
I dont know if this solution fits your needs, but you can define a custom mask
$.mask.definitions['h'] = "[0-9]{0,1}";
$("#form\\:your_input_mask_id").mask("hh;hh;hh;hh;hh;hh");
in your document.ready function. This will leave the _ character as is, but I guess you can handle it in your code when splitting the string and handling each part. I've put form\: because you generally put these inputs inside a form with id form. Change accordingly!
This has the downside though, that if you dont enter something, it will also validate, regardless of not being between 1 and 99.

xpages default value for combobox

I found this : Xpages Date Time Picker field defaults to today's date
I tried adding return null as default value for my combobox, but it still returns the first item from the list.
I also tried adding a formula item: #Text(""), but even if the default value is blank, it appears also as an item for the combobox.
Please help, thanks for your time.
One thing I do often for defaults.. and I forget if I do this for Comboboxes or not. But I'll bind the control to a viewScope variable. Then in beforePageLoad I'll set that viewScope variable to "" basically. I find this works better then the "default" option on the pretty properties pain. Maybe you want to give that a try.
In THEORY if that works then it will be blank to begin with.. but once it's changed you might probably can't put it BACK to blank. In order to to that you'd need to have a blank option at the top of your values list.
I am sure that there is a better way to do this, but....
I always use a normal item ojbect with one single space written in as the label and value. Under that I put my calculated values. Then for the default value, I put " ". It might not be pretty, but it gets the job done. When I read the value, before asking if it is empty, I just use #Trim() to make sure that it is indeed a real value.
Of course you could make the label a single white character space with a value "empty" and then use "empty" as your default value. The label would then be a single white space character.

Resources