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

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.

Related

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

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.

Microsoft Access 2013 Record Source Columns

I recently got tasked with customizing a report in an access database, I havent touched access in years so its a little rusty for me. I have successfully added the Fields to the table, added them to the form and added them to the report. If i run the report they query correctly. But all the other fields on the report are setup with an expression such as:
=IIF([Mold Temp High]=0,"----",[Mold Temp High])
Now the expression makes 100% to me but when it auto populates the field, such as Mold Temp High, for all the previous fields i can see they show up as Record Source Column fields, but for any new field i have added shows up as a Text Box.
If i create an expression with the new fields i get a Circular Reference and it shows #type on the report instead of the value.
Just curious to why the new fields show up as TextBoxs and not Record Sources.
I'm guessing that you are dragging the new fields from the field list. When you do this, it creates the text box with the exact same name as the data field. So when you use this name in an expression, it thinks you are referencing the text box object. To prevent this problem, make sure that every time you create a new textbox (or any control) from a data field that you name it something different by setting the Name property of the text box. Generally I just add "txt" to the front of the field name. This will ensure that you are always explicitly referring to either the textbox name or the data field name.
What if you change your logic around a bit..
We remember, IIF is constructed as:
=IIF((Some_Table_Field or value),True-condition,False-condtion)
You maybe looking at:
=IIF([Mold Temp High]=NULL,"----",[Mold Temp High])
Or, maybe (use ISNULL or ISBLANK it has been a while for Access with me as well):
=IIF(isnull([Mold Temp High]),"----",[Mold Temp High])
Or, rather:
=IIF([Mold Temp High]<1,"----",[Mold Temp High])
Hope this makes sense.

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

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.

How to Compute a Field in a Form from another Form or View in a Lotus DB

I have form "A" which there is a field that I need be computed after composed from Form "B". The forms are in the same database. I am not sure if it would be better to have the Form "A" field compute after composed from a "View" that uses the Form "B" or what would be the best way to get the field populated.
I have tried to do a #DBlookup, with no success.
Thank you!
Forms do not contain information, only documents do. Forms just represent information stored in documents.
Assume you have a view with name: "viewName" and it displays a set of documents.
The first sorted column of this view contains key values.
We want to get value of field someField by key from this view.
Create a new form, create a "Computed when composed" field and set the following formula as value:
#DbLookup("":"NoCache"; #DbName; "viewName"; "keyValue"; "someField");
It will access view "viewName" in the current database, get a document by "keyValue" and return value of field with name "someField"
I have tried to do a #DBlookup, with no success.
Well, what went wrong? Why didn't this work? When do you a #DbLookup call, you need to provide a view, a "key" and the field or view column you want to pull back from the matching document. Assuming you have a key with which you can link document A and document B, the look-up should be pretty straightforward.

Resources