Create a repeat from a multi-value field and assign a URL link to each row - lotus-notes

I need to create a repeat using two fields on the same form. In other words, the repeat has to appear at the bottom of the form like we used to do with embedded views. On this repeat I have two columns. They both have the same number of entries and they need to line up. The fields are OriginalFileName and NewFileName.
On first column (OriginalFileName), each row has to become a link and the second column is just the list from the second field (NewFileName). The URL can be either the attachment as it exists on the document itself or if it has been detached, it has to become the path to where it is stored on the network. The path is also stored as a variable on the document so once it is detached, it is filled in.
First, is it possible to create a repeat using values from the document that contains the repeat?
Second, how do I write the HTML that I need to add to make the URL in either case. The path for the detached file will always be the same for all rows in the repeat, it is just the file name that changes.

If you know how many entries there are in the multivalue item then you can set the repeat's data source to be based on javascript and just return the number of times you want to repeat. If you don't know the number of items in the multivalue field then you can set the repeat's data source to be the document and field. In both cases you'll need to set the max repeat value to higher if you suspect that you'll have more then 30 entries so all can be displayed at the same time or you can add a pager pointing to the repeat component.
Accessing the data of the two fields is fairly easy, a multivalue field is just an array and you can pick out a single item of the array using a document.getItemValue("fieldName")[arrayIndex]. To know what array index your on in the repeat there is a configuration field for 'Repeat Index' where you can type in a variable name, just use that variable name for arrayIndex.
Now it is just a case of building your table or list in the repeat and adding in link and computed text controls that use the arrayIndex to get their values.

Related

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

LotusScript - Why do we use array index to access value of text field

I am working on some LotusScript code and came across this syntax to access a text field value: textField(0). I checked this field's properties in the design and it has the type of Text and doesn't allow multiple values. But why do we use the index to access this field value? I need to describe what the code is doing so it makes a difference between "get the value of textField then do something" vs. "get the first element of textField then do something".
The LotusScript expression document.textField is a shorthand form of document.GetItemValue("textField"). As explained in Designer Help, this expression always returns an array of strings for text or text list fields. That's why one has to use document.textField(0), or document.GetItemValue("textField")(0) for that matter, to access the first (and possibly only) element in the returned array.
An important thing to remember is that just because the field properties say that multiple values aren't allowed today, they might have been allowed in the past. Nothing gets "fixed up" in old documents if you change the properties in Domino Designer. Your code always has to consider that possibility.
And for that matter, even when the field properties do say that multiple values aren't allowed, those properties only apply when a user is editing the document using the defined form. An agent or code using any of the Notes APIs can always store multiple values in any text field.
That's why you always access item values through an array. It's not just a matter of "that's how the API works". It's a matter of how the underlying storage works.
And remember: Notes is schemaless. You have to always assume the following:
The item that corresponds to the field might not exist.
The item might be empty even if there's a validation formula that requires it to be filled in.
The item that corresponds to a text field might not actually be a text item.
The item can contain a list even if the multi-values property is not checked.

Set field value based on saved search

I want to set total sold quantity in last six months in custom field on item and want to use that for other customization.
I am able to display it on the field using summary search but not able to save it.
The value of a Saved Search custom field is calculated every time the record is displayed and not stored in the database, which is why you can't use it directly in other customizations. A workaround is to have a second field which stores the value, and then you can use a Workflow or script to copy the field value.

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.

Joining sharepoint 2007 lists in a web view based on a common key field

So - I'm making a data view that is to contain a list. This list has a field that will be used to match up against two other lists. If there is an entry for this value, it should show the value from the other list, otherwise show a link to add a new one.
So, what I need to do is make a data source consisting of the rows from list 1, and fill in the Ticket field with a value from the Tickets table matching the ID value from list 1. The same should be done for the Change Type field.
Can anyone point me in the right direction to accomplish this? I've found a few tutorials, but they seem to be for showing all the data together and not match up on any specific columns for linkage.
Thank you
What you are aiming at is not available in SharePoint out of the box.
There are two approaches you can look at:
Create your own custom lookup field template for single/multiple field
selection with some sort of field
editor. Create your own controls and
program the associated code behind
logic.
Use some existing custom solutions. One such sample is on codeplex:
SharePoint Filtered Lookup Field

Resources