I have a selectize element, and my goal is to get the array of selected objects.
$('#my_selectize_input').val() yields "3,4,67". In order to transform it to the necessary form, I use the following:
JSON.stringify($('#my_selectize_input').val().split(',')),
which looks quite awkward. Is there a more elegant way to get the array of selected values ?
Documentation says "items" is the initial selected values. I'm not exactly sure if this is the answer, but it seems to be working on my tries.
$('#my_selectize_input')[0].selectize.items
Related
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.
Display multiple results using an Nested if statement.
Is there a way to display multiple results from a nested if statement? or how do i change it to do so.
I am currently using:
=IF(H3="Yes",D3,IF(AD3="Yes",E3,IF(AZ3="Yes",F3,"None")))
If more than one is yes I would like to display both results.
Would I need to create a long IF(AND( statement including all of the possible outcomes or does someone know a quicker way ??
The order in your formula is incorrect.
First you need to check all the ANDs and then you can check for the single occurrences. So, your formula should start with
=if(AND(H3="Yes";AD3="Yes";AZ3="Yes");D3&E3&F3);if(and(H3="Yes";AD3="Yes");D3&E3...
and towards the end of your formula you are adding the single checks
if(H3="Yes",D3,if(AD3="Yes",E3,...
I have 100 documents with a multi-value field. The field holds 5 possible values (Albert,Ben,Chris,Don,Ed) let's say. The field must contain 1 value, but can contain up to 5.
I need to compute the number of docs that contain each value, so
Albert 56
Ben 22
Chris 79
etc.
This seemed easy. I constructed a view that contains the docs, the first column is the field, and I selected show multiple documents for multiple feeds.
In SSJS loop through my master list of values in the field, and for each one do a getDocumentByKey.
myArray = applicationScope.application;
var dc:NotesDocumentCollection;
for (index = 0; index < myArray.length; ++index) {
dc = view1.getAllDocumentsByKey(myArray[index]);
Print(dc.getCount())
}
This gets the first value correctly, but none after. If I just hard code a particular value, it works. But when I call the getAllDocumentsByKey a second time, it doesn't return the right value.
I think this would work fine in LS, but in SSJS I must clear or recycle or rest something, but I don't know what.
Bryan,
Two things to try in this order:
Your first line of myArray = applicationScope.application; doesn't look right. I suspect that you are not actually getting an array here. I think you are just getting the first value from your applicationScope. Add a print statement on the next line of print(myArray.length); If it is always equal to one, that is your problem. You are not using var and you should set the variable to some java type using a colon.
Before the end of your for loop, try setting your collection to null. dc = null; This way you know for sure that you are getting a new collection in the next iteration.
Are any of your multi-value field values ambiguous? getAllDocumentsByKey(Vector) does partial matches. Unless you ever want that, I would recommend always using the second parameter and setting it to true, same always for getAllEntriesByKey().
An alternative, which will definitely perform better, would be to add a total column to the view. There's a performance hit of that on the view indexing, but you can then use a ViewNavigator with getColumnValues() and getNextSibling(). getCount() is extremely poor performing in LS and will almost certainly be as poorly performing in SSJS/Java. See this blog post from a few years ago http://www.intec.co.uk/why-you-shouldnt-count-on-a-notesviewnavigator/
If I understand that right: you want to count all values that are possible over an amount of documents to have a 5 value list with corresponsing 5 value counts, right?
You could loop through all docs, loop through all values and add entries to a HashMap with the value as key and an int as value (which should be increased everytime). Afterall you have a Map with 5 values holding the sums of each keys.
You will never get the right answer with getAllDocumentsByKey(). When document shows in one category, it will be missing from the collection of next category. That's the way it works.
Use ViewNavigator instead. Build it by category and simply count ViewEntries.
I have : <xp:repeat id="repeatColor" value="#{productcolors}"
var="rowData" indexVar="rownum" >
PROBLEM : rownum goes from 0 to the last correct value, but rowData is always the same
This repeat control is bound to a view "productcolors" , a view with a key on product code.
This view has a first column with the product code , ascending (for the key).
It also has a second and a third column with ascending multiple value fields.(second is framecolor, third is upholstery color)
The idea is that the repeat control goes through the different colors for the selected product, but it only shows the first one and does that the number of times (rownum increases correctly)that there are colors for the selected product.
EDIT :
So I have for example a product called "A" available in framecolors "1" "2" and "3"
When I am using the repeat control rownum changes from 0 to 2 but rowData is always the reference of framecolor "1". I don't know why rowData isn't changing.
When I use rowData.getUniversalID() I am getting 3 times the ID of the document containing the multiple value field with the 1 , 2 and 3 in it, which is I guess normal ? But how can I get a handle to those different values inside it ?
SECOND EDIT
I tried :
var testje:string = rowData.getUniversalID();
var db:NotesDatabase = session.getDatabase(database.getServer(),"product/colors.nsf");
var doc:NotesDocument = db.getDocumentByUNID(testje);
test = doc.getItemValueString("colorUpholstery");
The result is that "test" only holds the first item of the multiple value field "colorUpholstery" .
How is that possible ? I thought I would get the complete value of the "colorUpholstery" field ?
Maybe because I only have reader access(Publicaccess) to the colors.nsf database ?
It would be nice to see a little more code... like what's inside the repeat.. just to get a better feel for it to go along with your description of the Notes View.
rowData should be an XSPViewEntry... basically a NotesViewEntry... I suggest you first do something like rowData.getDocument().getUniversalId() to make sure it is iterating the documents correctly. I'm sure it is.
It sounds like you're trying to do something with a multi-value field.. are you also setting the view to use display multiple values as row entries? or whatever that setting is? That might get dicey if that's turned on. Not sure.
Again I'm not totally following what what the goal is but I would first test to make sure it is actually repeating the expected documents. then it's all about fine tuning.
EDIT: Ok... some thoughts based on your additional info:
I suspect that your problem is the use of the view setting "show multiple values as separate entries". Each is the same document really. So that's likely not helping you here. I'm still a little fuzzy on exactly what you want for the output. Is this from a "view page" of maybe products? a "form page" of a single product?
I ASSUME you want all the colors for a single product? And this is a lookup view right? so you're on your product "document" and now you want to list all the colors?
Assuming so...
Use SSJS and the object model. Do a lookup to find the SINGLE document that has the multi-value color field for your current product. then return to a repeat control something like:
lookupDoc.getItemValue("colorField")
I'm not 100% sure that's the correct syntax. The point is you can send a multi-value field to a repeat control and it will repeat it. Much easier then trying to use view tricks.
If your goal is to have a Repeat of multiple products.. and in side each "row" to show all the available colors then you're looking to have a nested repeat really... The outer repeat (outerData) to iterate over all the main products and inside that another repeat (innerData) for the colors. Inside that repeat code you use the "outerData" to get the multi-value field. Something like:
outerData.getDocument().getItemValue("colorField")
Assuming I'm understanding you correctly these are my suggestions.
I did do an example of nested repeats like this on an early NotesIn9. I believe it was this one: http://notesin9.com/index.php/2010/03/30/notes-in-9-show-14-repeats-repeated/
Maybe that will help.
Second Edit Response:
Based on the code you added you're using "doc.getItemValueString()" By design that will only get you the first value of a multi-value field. This is the same as saying in LotusScript:
doc.colorUpholstery(0)
or the less commonly used
doc.getItemValue("colorUpholstery")(0) ' I might have that wrong. I never really used it
Again if you want to make a list of all the colors I'd use a repeatControl and pass in:
doc.getItemValue("colorUpholstery") then your "rowData" for that repeat will be each value. I've seen others avoid the repeat and doing some javascript explode or implode type thing I believe. using "\N" or something as a separator for a new line. I just use a repeat. Easer for me to understand.
Again I THINK everything you need really is in NotesIn9 episode 14.
Within my InfoPath form (which has to be loaded within a SharePoint Portal by the browser)I have a repeating table containing multiple fields. Now I would like to make the first textfield autoincrement starting by 1. How exactly can I do this?
I have already heard of a way by using the "count" function but this produces errors or in best case a static number which unfortunately does not count.
The function I have added for the field is "count(.) + 1"
Any suggestions?
Let's say your repeating group is called "item" and your autoincrement field is called "index". The default value of the index field should be
count(/my:myFields/my:item)
This should count correctly for you.
I suspect you really want position(). Count is just going to return the total count of nodes that match the xpath expression you give it.