Get TreeListView cell value programmatically in ObjectListView - objectlistview

How can I programmatically obtain the value of a cell in OLV's treeListView using the row and column index?
treeListView.GetItem(0).GetSubItemAt(6,e.rowIndex).Text
for example does not appear to work, it just gives me the string value of the first cell of the first row. Also I do not understand the answer here:
ObjectListView: select subitem programmatically

Working with the sub items is not recommended and you should never have to access them when using the ObjectListView/TreeListView controls.
You should retrieve the model object of the required row instead, and then access the property that is related to the column/cell in question.
You can retrieve the model with
MyModel model = objectListView1.GetModelObject(rowIndex) as MyModel
where MyModel is your underlying model class.

Related

Tabulator: Is it possible to set the cell edited property programmatically?

When setting up my Tabulator Table, I am using the cellEdited event to update the column value in all of the selected rows using cell.setValue(). The value is being updated, but cell.isEdited() returns false.
I understand this is by design, but I am wondering if there is any way that I can modify the cell edited property programmatically (specifically set it to true) so that after updating these values I can call table.getEditedCells() and use the returned cells to create a list of rows that have had values modified.
I am just wondering if I missed something in the documentation or if this is not currently supported?

How do I use a power apps form for a lookup column?

I have a SharePoint List (say "List-A") with plenty of columns, some of which are lookup columns.
These are just used to construct a choice columns, where the items in the choice drop down are the items of a column in a different List ("List-B").
I have used the function on SharePoint to integrate List-A with Power Apps Form. This creates a Power Apps form that is readily available.
For the Lookup choice columns, I have added List-B as the data source, and am using the items from the correct column as items in the choice that is linked to the lookup column. This correctly populates the drop down menu as expected.
Now when I publish this form and fill it from sharepoint (it pops up as it should hafter clicking New in the List view) I can fill the entire form and submit with no issue. However all the lookup columns remain blank, as if the form returned a null value instead of the selected.
I have both datasources set up:
The update property of the datacard connecting to the SharePoint List is equal to the Selected of the datacard containing the combobox (combobox is called DataCardValue43).
The items property of the combobox is equal to the correct column of List-B.
As an alternative solution, I have attempted to make a different column that is just one line of text. For this column, I have made a combobox once again setting the items property to the column in List-B. The intention was to return the selected value as a string. It was attempted thus:
where combobox1 once again manages to give the correct options in the drop down box but returns only Null.
To study it further, I have made a power apps flow that takes Create New Sharepoint List object as input. Here I see that the values are indeed Null
The one called "Return" is the text column that I made, and the other being the lookup column. I do notice that the Lookup column isn't called Value, but id. I don't know what to do with that information though.
I really just want to have a column in my power apps form that lets you choose and the choices are values from a column in a different List. What do I do, and why doesn't what I've already done work?
Thank you.
Please follow the steps below to solve the issue.
1: Add a Lookup column in SharePoint List.
2: Open that list in Power Apps by using the Customise Forms Option From SharePoint.
3: The Item property of Lookup field will be by default as follow:
Choices([#'CustomisingSharePointList'].LookupColumnListName)
4: There is no need to change/delete the lookup field with any custom dropdown or combo box. This is the point, where you are doing mistake by adding a custom combobox and replacing the original Lookup dropdown. If you want to change datasource, apply filter or sort the data, you can do all these thing to the same original lookup column.
e.g I have applied filter and sort functions to the existing data:
Sort(Filter(Choices([#'CustomisingSharePointList'].'LookupColumnListName'), Value in Filter(LookupColumnListDataSoure,Progress.Value = "Open").ID),Id)
5: When you will publish the list, it will work fine.
Note:
CustomisingSharePointList: List in which we have added a lookup column.
LookupColumnListName: List to which the lookup column actually belongs to.
LookupColumnListDataSoure: You need to add the original list as data source in power apps to use the above filter. This step is optional and applicable only if you apply filter like I did in step 4

Using Power Apps to add a new value to a multiple-value choice column in SharePoint without overwriting existing values

I have a SharePoint list that contains a choice column with the 'multiple selection' option turned on. Each item in this list contains data related to preferences for a given user, and the choice column will store the IDs for each of the user's 'favorited' reports.
I would like to write a Patch formula in Power Apps that writes a new value to this column, but retains the existing values. Here is an extract from my current formula, triggered when a user selects the 'Add To Favorites' button, where 'Favorites' is the choice column that already contains values:
Patch(
'Platform User Preferences',
LookUp(
'Platform User Preferences',
UserEmail = User().Email
),
{Favorites: [ThisItem.ID]}
)
Current state, this formula overwrites the existing values in the choice column with the new single value, instead of adding it alongside the existing values.
One approach I have attempted (based on reading similar use cases online) is to create a collection from the Favorites column, add the new value to that collection, then patch the entire collection back to SP. However, I have had similar problems doing this as I do not fully understand the model of a collection that is based on a multi-value choice column. For example, the following also appears to completely wipe the data in the collection, rather than add to it:
ClearCollect(favslist,Filter('Platform User Preferences',UserEmail = User().Email).Favorites);
Collect(favslist, {Value: ThisItem.ID});
Any help with solving this problem would be most appreciated!
You'll need to create another collection that contains each selection of the existing favorites. Right now your 'favlist' collection contains one item that contains all the existing favorite selections, then youre adding you new item. This isn't formatted correctly this way.
Try updating your existing code before you patch, by using a ForAll and collect the existing items:
ClearCollect(existingfavslist,Filter('Platform User Preferences',UserEmail = User().Email).Favorites);
ForAll(existingfavlist, Collect(favslist, ThisRecord.Value));
Collect(favslist, {Value: ThisItem.ID});
Then just patch your collection 'favslist' to the list

Existing documents can be found and updated with imported data (using view lookup or database search).

I have a list of ID and Color in excel sheet.
I need to import file and check existing if any changes to the color value.
If there is any changes, I need to update new value and recored old value in history field.
How do I do this?
First, save the Excel spreadsheet as a CSV file, it will be much easier to import it then. Use the file functions in Lotusscript.
Next, write your Lotusscript agent. You have the solution in the headline of your question, so I am not really sure what you are asking.
You could use the GetDocumentByKey() method of the NotesView class to get the document based on the ID, then compare the value of the color field in that document. If it is the same, go to the next document, otherwise add the existing value to teh history field and replace it with the new value, then go to the next document.
Another, and much faster, way would be that you read all the new values into a list, with the ID as list tag and color value as list item. Make sure you have a view with the document ID as one of the columns and color value as another. Create a NotesViewEntryCollection object, then use the GetFirstEntry/GetNextEntry methods to loop through the collection. For each entry, use the ColumnValues() method to get the value if the ID column, and use IsElement to check if that value exists in the list you created. If it does exist, you compare the list item value with the value of the color column. If they are different, open the document, update the history field and replace the old color value with the new value.

Core Data Relationship shown in tableView

I am developing an application with a tableview showing the content of a core data table.
The datamodel is something like this:
Entity(name, code)->>Translation(text, code)
I retrieve all the entities using the usual NSFetchedResultsController, but then once is time to populate each row (through tableview cellForRowAtIndexPath:) I have to dive into each entity to retrieve 2 translations based on the code inputed by the user. I am using a NSFetchRequest to do that but I was wondering if it is the right thing to do (one fetch request each time I populate a row).
Instinctively I would retrieve all the data I need in the NSFetchedResultsController, instead of searching for each translation each time I populate a cell, but I cannot figure out how.
Do anyone has some advice, or maybe some interesting links?
If each cell must display the Translation objects related to each Entity object, then you only need to walk the relationship from the fetched Entity object to the appropriate Translation objects.
Once you've fetched the Entity objects and then structured the table to display them, then to access the values in the translations for each cell row like so:
NSSet *translations=[anEntityObject valueForKey:#"translations"];
... which returns a set of Translation object for the Entity object represented by the tableview row.
As a very general rule, you only do one fetch per tableview. A table view should be configured to display data related to one particular entity.

Resources