Can someone help me with Exception occurred calling method NotesDatabase.FTSearch(string) - lotus-notes

I'm trying to do a database full text search and struggling to get it to work.
Since I'm working with date fields, I deleted my full text index, set all my blank date fields to a fictitious date (3/15/2050), compacted the db and then rebuilt the full text index.
However, I am still getting the error for this query string:
(FIELD Form CONTAINS 'Opp') AND (FIELD Topic CONTAINS 'A') AND (FIELD DateTeam >= 3/1/2019) AND (FIELD DateTeam <= 3/31/2019)
I didn't have the single quotes in there initially, but tried it as a suggestion from another post. I also tried putting # before and after my dates, but no luck there either.
What am I missing? My customer is getting frustrated.

You didn't post the verbiage in the exception, nor say what Domino version you were using, so this is somewhat guesswork.
It could be that the UNK table (Domino's internal field catalog) thinks the field is a string field. The first value stored in a field is the type that the FT index uses to determine the indexed data type. Of course any type can be stored in the NSF data but the FT code tries to limit this type of search to fields it believes will work.
Now if those CONTAINS values are actually = values, then DQL can help you. We'll be putting CONTAINS as a verb into DQL in V11, but it (DQL) can certainly perform your date range term. Just a thought.
-John Curtis

This might help: https://www-10.lotus.com/ldd/dominowiki.nsf/dx/full-text-syntax
As far as I know date values must be in [] to work.
A good start is to test your formula in the client with the FT search function instead of altering your code.
By the way: you can shorten your formula omitting the FIELD keyword and putting the field name also in [].

I tried this in my mail database:
(FIELD Form CONTAINS "Memo") AND (FIELD Subject CONTAINS "the") AND (FIELD PostedDate >= 3/1/2019) AND (FIELD PostedDate <= 30/6/2019)
And it works correctly. So double quotes instead of single, and you might have to check whether your date format corresponds with the server's.

The approach I was taking was correct. The problem, however, was that my update agent to set all the date fields had a typo in it so it wasn't setting the right fieldnames to dates. My oversight. Once I found that and corrected it, I retraced my steps and it all works as intended now. Thank you to all for helping me find the solution.
For anyone else, I took these steps:
Open database properties and delete the full text index
Run this command on the console to compact the db: lo compact folder/db.nsf -c
Run an agent against all the docs to set the date fields to a fictitious date
Open database properties again and create a new full text index
When completed, run this command on the console: load updall -f folder/db.nsf
Run the agent again to reset the fictitious dates to blanks

Related

How to catch an exception in a Netsuite saved search formula?

I have a saved search that looks at a custom text field on a Sales Order. The custom field should contain an ISO date. I want to get all records where that date is greater than today. My first attempt was to try Formula(Date) with the formula below and condition "is greater than today"
TO_DATE({custbody_est_delivery}, 'YYYY-MM-DD')
However this gave me an "Unexpected Error" when I tried to do the search. I worked out this was because not every record has an ISO date, some are null and some have been edited to contain some non-date data. It seems that if any row returns an error the whole saved search fails. I therefore want to exclude anything that doesn't parse as a date from my search. However, I could find no way of catching an exception from the TO_DATE function. For the moment I have:
CASE WHEN REGEXP_LIKE({custbody_est_delivery},'(\d{4})-(\d{2})-(\d{2})') THEN TO_DATE({custbody_est_delivery}, 'YYYY-MM-DD')ELSE TO_DATE('2099-12-31', 'YYYY-MM-DD') END
This works, but it is a horrible hack and would fail if someone e.g. wrote in '9999-99-99' in the field.
How can I catch exceptions in a Netsuite saved search formula? I'm looking for something like the pseudocode below:
IFERROR(TO_DATE({custbody_est_delivery}, 'YYYY-MM-DD'), <do something sensible>)
You can use the NVL2 function to conditionally take care of any empty field values.
e.g.
NVL2({custbody_est_delivery}, TO_DATE({custbody_est_delivery}, 'YYYY-MM-DD'), '')
See the Help page titled SQL Expressions for all of the formula functions available to you.
Personally I'd say any field values that are invalid dates are a data problem and should be corrected with a mass update or CSV import, and validation rules should be added to your custom field such that no invalid dates are allowed.

Multi LookUp - Check for unique values

I´m trying to set up unique values in my PowerApp-Form. The data is stored in a Sharepoint list. I have a column called watches, items in this column have a unique number, which have to be unique. People can pick multiple of those watches in a LookUp-field. But before submitting the form, I need to check if those picked values already exist in my list and at least display an error message.
I have setup a regular text field and added following rule to it:
If(LookUp(MyList.Watches;DataCardValue4.SelectedItems.Value in Watches;"OK")<>"OK";"No Error";"Watch already exist")
DataCardValue4 is my LookUp field, where people can pick those watches. With this rule I want to check if a item already is in my column watches and let my text field display the error. Somehow the rule doesn´t work.
Can you tell me how I compare multiple lookup choices to my table/column entries?
The first parameter to the LookUp function should be the table (SharePoint list) rather than the column. So the first parameter should be 'MyList' rather than 'MyList.Watches'. Also, I'm not sure that the formula provided (second parameter to LookUp) will work. In your formula, you will be looking for multiple items (DataCardValue4.SelectedItems.Value) within multiple items (Watches). Perhaps you can update your app to have users only pick one watch value before submitting?
One last thing to note. I'm not sure how big you expect your SharePoint list to get, but I would highly recommend keeping your LookUp formula within the bounds to support delegation. More specifically, SharePoint has different formula requirements than other connectors. For example, you can use '=' in your formula, but not 'in'.
Your new rule might look something like below. Please note that it could have syntax errors and might not even be delegable in it's current form since I am providing the rule with no checking. Also, I switched from using LookUp to using Filter instead just because I'm more familiar with Filter. However, both functions are very similar.
If(CountRows(Filter(MyList; DataCardValue4.Selected.Value = Watches)) > 0; "Watch already exist"; "No Error")

Power Query - Check if source value is in another list/table

I'm experimenting with PowerQuery and I got to a good point, but I'm stuck with something. I checked here and other places, but couldn't find anything that helped me solve the issue.
I have a Source in PQ I can use and transform. Once this Source (a .csv) is loaded in PQ editor, I would need to verify if a specific column value is in another table/list or not.
So I created a small table in another sheet and created another Source for it.
I am trying to create a new column and validate now with "each if" if the current main Source value in that column (that obviously varies, they are names) is part of the list/table that is the other Source. And in case it is, the added column value will be YES, otherwise NO.
A simple check that in Excel I would have done probably with vlookup.
I always referred here as list/table as i tried to have it created as List or table, without success.
Is anybody here able to help?
= Table.AddColumn(#"Promoted Headers", "Real_A", each if Table.ContainsAny(Source, EMEAL, {[Analyst]=[EMEA]}) then "EMEA" else "XX")
This is what I tried last. The "Source" is the .CSV I read already and [Analyst] is one column of it.
[EMEA] is the name of the column in EMEAL (list).
The error I have:
Expression.Error: We cannot convert the value "Pippo" to type Record.
Details:
Value=Pippo
Type=Type
"Pippo" is the value in [Analyst] column, but as well one of the value in the EMEAL list... so, also here quite confused where the issue really is.
thanks!
The equivalent to this kind of VLOOKUP is a Merge-opertion like described here: http://www.myonlinetraininghub.com/excel-power-query-vlookup

How to eval a field name contained in another field in an Access Query?

I need to create a long list of complex strings, containing the data of different fields in different places to create explanatory reports.
The only way I conceived, in Access 2010, is to save text parts in a table, together with field names to be used to compose the string to be shown (see line1 expression in figure). Briefly:
//field A contain a string with a field name:
A = "[Quantity]"
//query expression:
=EVAL(A)
//return error instead the number contained in field [Quantity], present in the query dataset
I thought doing an EVAL on a field (A), to obtain the value of the field (B) which name is contained in field A. But seems not working.
Any way exist?
Example (very simplified):
Sample query that EVAL a field containing other field names to obtain the value of the fields
Any Idea?
PS: Sorry for my english, not my mothertongue.
I found a interesting workaround in another forum.
Other people had same problem using EVAL, but found that it is possible to substitute a string with a field contents using REPLACE function.
REPLACE("The value of field Quantity is {Quantity}";"{Quantity}";[Quantity])
( {} are used only for clarity, not needed if one knows that words to be substituted do not compare in the string). Using this code in a query, and nesting as many REPLACE as many different fields one want to use:
REPLACE(REPLACE("<Salutation> <Name>";"<Salutation>";[Salutation]);"<Name>";[Name])
it is possible to embed fields name in a string and substitute them with the current value of that field in a query. Of course the latter example can be done more simply with a concatenation (&), but if the string is contained in a field instead that hardcoded, it can be linked to records as needed.
REPLACE(REPLACE([DescriptiveString];"[Salutation]";[Salutation]);"[Name]";[Name])
Moreover, it is possibile to create complex strings context-based as:
REPLACE(REPLACE(REPLACE("{Salutation} {Name} {MaidenName}";"{Salutation}";[Salutation]);"{Name}";[Name]);"{MaidenName}";IIF(Isnull([MaidenName]);"";[MaidenName]))
The hard part is to enumerate all the field's placeholders one wants to insert in the string (like {Quantity},{Salutation}, {Name}, {MaidenName}) in the REPLACE call, while with EVAL one would avoid this boring part, if only it was working.
Not as neat as I would, but works.

Using a NetSuite saved search formula to filter from system notes

I am attempting to use a NetSuite saved search to bring back system notes for whenever an assigned person changes for a case. However, I would like to grab the initial assigned person and not the multiple re-assignments after that. Is there a way for me to only select the initial value rather than having all re-assignments come back to me? Is this able to be done from a formula somehow?
to get the oldest assignee of case you can use below criteria so, that results is restricted to just one result per case
1) System Notes : Field is assigned
2) System Notes : Old Value is empty
In the results add the column System Notes : New Value along with other columns of case. This field will pull the oldest assignee of the case
PS : solution assumes that there won't be any empty re-assignments. If there are empty re-assignments you should sort the results by Case unique identifier such as number or internalid and then by System Notes : Date, and the oldest date line would be the result that you are looking for.
Actually you can do that with a search clause where the old value is empty

Resources