I am trying to update a Lookupvalue field "Items" via the SharePoint object model.
"Products" is a column in one list which is used as a lookup column to another list in field "Items".
In my webpart i have dropdown of Items now
string strItems = ddlItems.SelectedValue.ToString();
item["Items"] = new SPFieldLookupValue("strItems");
item.Update();
However, this is causing an error
Internally, SharePoint stores these references like this:
NumericID;#DisplayValue i.e.
145;#Soup
12;#Cake
874;#Steak
That is the kind of thing that should be in the constructor to SPFieldLookupValue. Or if it is more helpful, use the variant of the constructor that takes an int id and string display value.
More info is laid out here:
http://blogs.msdn.com/b/sridhara/archive/2007/08/25/update-quot-lookup-quot-fields-in-sharepoint-2007.aspx
You need to set the Items column to the ID of the SPItem represented by the product. You could do this by setting the DataTextValue of your dropdown to ID and then using the SelectedValue. You could also do a CAML query when a new item is selected in the dropdown.
You can find more information at the bottom of this blog post:
http://weblogs.asp.net/bsimser/archive/2005/05/13/406734.aspx
Related
Relatively new to Blue Prism,
I have a collection that looks like this, with 100+ rows:
Results
Answer
Timestamp
8 Apr 2021
Name
ABC
I'd like to manipulate the data such that if Results = 'Name', Get the Answer (aka ABC) and put it into a data item.
Is there any way to do this?
I understand I could hardcode i.e. Get value based on Row Index and Column Index, but my data is complex and may not always have the same rox index.
Can you use the collection filter to get a collection output? The utility has an action to filter where you can input a collection and then use
[FieldName] Like "some value"
This would result in every complete row in the collection that matches the filter.
Good afternoon,
I am creating an app using sharepoint and powerapps, on powerapps I have a form that feeds from a sharepoint list. Now my problem is the following, when I create a new form I would like to submit from another sharepoint because it is going to be easier for me to create reports.
If I understood you correctly, you have a Form tied to a Sharepoint List and you want to copy its contents to another Sharepoint List with the same column structure. Is that correct?
If that is so, this is how you do it:
1) Add both SharePoint Lists (List1 and List2) as DataSources to your app
2) Set your form's Data source to List1
3) Select the fields you want to edit
4) Add a button to your form. Set the OnSelect value of the button to this:
Patch( 'List2', Defaults( 'List2' ), { Column1: val1, Column2: val2, etc.. } )
where val1, val2 etc.. are values you entered into your controls
Ex: = txtFirstName.Text, ddlStartDate.SelectedDate etc..
NOTE: Your column names have to match the exact spelling of the column names on List 2. If you have any multi word column names, put them in single quotes. Ex: 'First Name'
See: https://learn.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch
and https://learn.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-defaults
Ive managed to get html table and change it to collection. However i would like for the table header to become the collection header. Is it possible to do it? Thanks.
Below is for further details on how i take the table element and change it to collection.
The path that im getting from the html table inside application modeller:
/HTML/BODY(1)/DIV(2)/FORM(2)/DIV(1)/TABLE(1)
Then i use Read stage and choose the table as the element and set Data as Get Table function and save the collection.
The collection result produces:
On header - Column1(text), Column2(text)....
First Row - Department, Name.... || This supposed to be the header
Second Row - DepartmentData, NameData....
Well, I got the action called "Set Column Names From First Row" in Utility - Collection Manipulation. Do you have it too?
If not, then here's the code:
Dim iThisColumn as integer = -1
For Each Column As DataColumn In Input_Collection.Columns
iThisColumn +=1
Column.ColumnName=CStr(Input_Collection.Rows.Item(0).Item(iThisColumn))
Next
Output_Collection = Input_Collection
I have two SharePoint list named city and town. I have created two datasets for each list in SQL Report Builder 3.0. The city dataset has ID and Title columns. Town dataset has ID, City_Id and Title.
My purpose is showing cityname and it's towns in same row.
I use LookupSet function like this:
=Join(LookupSet(Fields!ID.Value, Fields!City_ID.Value, Fields!Title.Value,"Town"), ",")
But, it gives just blank field. How I can use LookupSet function.
Thanks
Fields!ID.Value and Fields!City_ID.Value are not same type. Fields!ID is integer, Fields!City_ID.Value is string. So I re-write my expression like this
Join(LookupSet(Fields!ID.Value, CInt(Fields!City_ID.Value), Fields!Title.Value,"Town"), ",")
I'm trying to get the contents of a cell in a row in a YUI datatable.
I can use myDataTable.getSelectRows()[0] to get the first selected row. However, how do I get the contents of the first cell in that row?
It looks like getSelectRows() returns an array of record IDs. You can retrieve the corresponding record using getRecord(). Once you have a record, use getData() to retrieve the value of the field you are interested in.
var recordID = myDataTable.getSelectRows()[0],
record = myDataTable.getRecord(recordID);
console.log(record.getData("myField"));
http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#method_getRecord
http://developer.yahoo.com/yui/docs/YAHOO.widget.Record.html#method_getData
I think I may have the answer for you assuming you have not already found it yourself.
I have the same kind of page with a datatable and a textarea field, when you select a row in the datatable calls the same page displays further detail from the selected row in the textarea field and retains selection of the selected row.
1: To do this I apply the following example MySQL query called AllMyBroadcasts...
SELECT #rownum :=#rownum + 1 RowNumber, p.*
FROM tblBroadcasts p, (SELECT #rownum := 0)r
ORDER BY Date DESC
the tblBroadcasts table has fields : Date, Narrative, ID
2: I then provide the following to the table row of my YUI Datatable within HTML hyperlink tags.
href="MyPage.php?SelectedBroadcastID=' .$row_Broadcasts['ID'].'&RowNumber=' .($row_Broadcasts['RowNumber'] -1 )
3: When the href is clicked MyPage reload with additional parameters SelectedBroadcastID and RowNumber the SelectedBroadcastID I use in a second query against tblBroadcasts called MySlectedBroadcast which a simple query on outputting all fields where the ID = SelectedbordcastID. I then to my field to display the narrative of my selected row in my textarea field.
The second paramater I do the following with.
$SelectedRowID = 0;
if( isset($_GET['RowNumber'])) {
$SelectedRowID = $_GET['RowNumber'];
}
Above I placed just after code covering my two queries.
4: Then finally to get the datatable to select the row of the selected row I include the following to the var yuidatdatable section of the datatable script...
yuidatatable1.select(yuidatatable1.getRow());
The -1 value referred to step 2 serves as a work around to fact that yuidatatable works on a 0 base and the MySQL referred to in step 1 on a 1 base.
There you go !
Perhaps there is a better why using get from within YUIDatatable scripting, be nice to know if so. That said this work fine for me and perhaps if you have not found an answer I hope this helps.