Sharepoint 2010 client model. Set multiple values in taxonomy field - sharepoint-2010

How can I set multiple values in taxonomy field using client model?
For single value I use follow snippet:
var item = ctx
.get_web()
.get_lists()
.getByTitle('News')
.getItemById($("#newsId").val());
var newTag = "40;#term_title|cd1df680-fff6-4d37-a336-95a2fbc0719d";
item.set_item("NewsTag", newTag);
item.update();
ctx.executeQueryAsync(function () {
});
it works fine for single value.
I have tried to use newTag variable as array and tryed to concatenate two strings {id};#{title}|{guid} with ; separator but it does not work.
Can anyone help with that?

I've found out the right way to set multiple values. Actually the delimiter is combination of semicolon and sharp ";#" not just a semicolon ";"

Related

Getting the first element of a comma delimited field during a foreach loop (SQL Razor)

How do I extract the first image name from a comma delimited field location_images in my SQL database during a foreach loop.
FirstorDefault() doesn't seem to work.
#foreach (var row in selectedPlace)
{
var selectedImages = row.location_images;
}
<img src="https://test.com/img/#selectedImages" />
So, the images are Comma delimited, then you can simply split it on the basis of comma and get the first string from the returned array of strings.
var firstImage = row.location_images.Split(',').First();
I finally got it working with 2 changes:
Search String was modified: to exclude records without any images,
and
Using: var firstImage = row.location_images.Split(',')[0];
It's still not ideal, as I can't see which records have missing images, but will do for now.
Thanks guys!

Splunk : formatting a csv file during indexing, values are being treated as new columns?

I am trying to create a new field during indexing however the fields become columns instead of values when i try to concat. What am i doing wrong ? I have looked in the docs and seems according ..
Would appreciate some help on this.
e.g.
.csv file
**Header1**, **Header2**
Value1 ,121244
transform.config
[test_transformstanza]
SOURCE_KEY = fields:Header1,Header2
REGEX =^(\w+\s+)(\d+)
FORMAT =
testresult::$1.$2
WRITE_META = true
fields.config
[testresult]
INDEXED = True
The regex is good, creates two groups from the data, but why is it creating a new field instead of assigning the value to result?. If i was to do ... testresult::$1 or testresult::$2 it works fine, but when concatenating it creates multiple headers with the value as headername. Is there an easier way to concat fields , e.g. if you have a csv file with header names can you just not refer to the header names? (i know how to do these using calculated fields but want to do it during indexing)
Thanks

How to use Substring in SSIS

I want to export data from SharePoint list to SQL using SSIS.
In SharePoint list, i have a column as multi select, So i am getting below value in my column
1;#control 1;#3;#control 3
I want to use substring in derived column in such a way that i should get below result
1,3
I want only ID from the given column.
I have tried below code
SUBSTRING(ColumnName,1,FINDSTRING(ColumnName,";#",1) - 1)
But it only gives me answer as
1
Can anyone please help me out.?
Because there is an unknown number of controls selected in your SharePoint Multi-Select, a Derived Column transformation is not going to work for you. You'll have to use a script.
One way to parse your string is with regular expressions. You'll have to add an output to the script transformation and assign your parsed string to that output.
Regex controlExpression = new Regex(#"control ([0-9]+)");
MatchCollection controlMatches = controlExpression.Matches(--YOUR INPUT HERE--);
String output = string.Join(",",
(controlMatches.Cast<Match>().Select(n => n.Groups[1].ToString())).ToArray());

Rally: Creating a multiple query based filter

I have looked at this to create a complexQueryFilter.
Here's my code:
QueryFilter complexFilter = new QueryFilter("c_TestReady","=","Yes").and(new QueryFilter("c_ExternalID","=",""));
The c_ExternalID field is a custom field in Rally of type String and c_TestReady is another field with values Yes or no. The query should return all test cases that are TestReady and whose ExternalID field is empty.
I also tried:
1."c_ExternalID","=",null
2."c_ExternalID","contains",null
3."c_ExternalID","contains",""
None of these seem to work.
Try escaping the double quotes, as in new QueryFilter("c_ExternalID", "=", "\"\"")
This worked for me:
storyRequest.setQueryFilter((new QueryFilter("c_CustomString", "=", "\"\"")).and(new QueryFilter("c_CustomCheckBox", "=", "true")));

SQL: Use a predefined list in the where clause

Here is an example of what I am trying to do:
def famlist = selection.getUnique('Family_code')
... Where “””...
and testedWaferPass.family_code in $famlist
“””...
famlist is a list of objects
‘selection’ will change every run, so the list is always changing.
I want to return only columns from my SQL search where the row is found in the list that I have created.
I realize it is supposed to look like: in ('foo','bar')
But no matter what I do, my list will not get like that. So I have to turn my list into a string?
('\${famlist.join("', '")}')
Ive tried the above, idk. Wasn’t working for me. Just thought I would throw that in there. Would love some suggestions. Thanks.
I am willing to bet there is a Groovier way to implement this than shown below - but this works. Here's the important part of my sample script. nameList original contains the string names. Need to quote each entry in the list, then string the [ and ] from the toString result. I tried passing as prepared statement but for that you need to dynamically create the string for the ? for each element in the list. This quick-hack doesn't use a prepared statement.
def nameList = ['Reports', 'Customer', 'Associates']
def nameListString = nameList.collect{"'${it}'"}.toString().substring(1)
nameListString = nameListString.substring(0, nameListString.length()-1)
String stmt = "select * from action_group_i18n where name in ( $nameListString)"
db.eachRow( stmt ) { row ->
println "$row.action_group_id, $row.language, $row.name"
}
Hope this helps!