I am very new to lotus notes. This will all be done on the client. I need to write a custom search that will search a particular form. This an example of the fields:
FormName = MyForm1
database fields are called Name1, Name2, Name3
datasbase fields are department1, deparment2, department3, department 4.
The search form will only have 2 fields. Name and Department. I need the following to happen, The name search field needs to seach all 3 name fields, the department field needs to search all 4 department fields.
Thank you for your assistance.
It depends a bit on exactly how fuzzy you need your search to be. Are you searching for an exact match, or for a partial match in those fields?
Assuming the exact match, you just need a formula that looks in the multiple name fields, and multiple department fields for a match. Let's call the search query fields NameQuery and DepartmentQuery. Then you could construct this formula which would return true if the value in NameQuery is found within one of the name fields, and the value in DepartmentQuery is found in one of the department fields.
#IsMember(NameQuery; Name1:Name2:Name3) & #IsMember(DepartmentQuery; Department1:Department2:Department3:Department4);
If instead you need to search for a partial match, you could use the #LIKE formula. First, concatenate the name and department field values into a single string using #IMPLODE. You can then do a wildcard match. This isn't very efficient, mind you, so if you're working on tens of thousands of documents you might want to find a better solution.
AllNameItems := #Implode(Name1:Name2:Name3; " ");
AllDepartmentItems := #Implode(Department1:Department2:Department3:Department4; " ");
#Like(AllNameItems; "%" + NameQuery + "%") & #Like(AllDepartmentItems; "%" + DepartmentQuery + "%");
Mike --
The built-in search will work fine for you, no doubt!
Here are the steps...
- Build your new form (ie, "MyForm" ) to hold your data;
- Build your view, to display your data as columns;
- Set your view's "Form Formula" to "MyForm" (with quotes)
- Make sure the "search bar", is enabled, for the view;
- Enter the values to search for;
- The results are displayed, nicely!
That should help...
Related
I am attempting to create a list of open pending approval sales orders that do not contain items with specific values defined in a custom field. I am able to do this when the sales order contains only items that meet this criteria. However, when their are two items and one meets while the other does not my search is no longer valid.
I have two sales orders. Sales order 123 has a shipping method of Ground, while Sales order 321 has an item with Shipping method of Ground and shipping method of Freight. I expect to get only Sales order 123 returned.
I made this formula in criteria section:
CASE WHEN {item.custitem_shippingmethod} = 'Freight' Or {item.custitem_shippingmethod} = 'Free Freight' THEN 1 ELSE 0 END
but got both orders returned. I tried using the same formula in the summary criteria but that also did not work. Any suggestions?
Picture of Criteria in NetSuite
Thank you!
You could potentially use summary criteria. It's practical but it's not the cleanest looking search. You need to have a corresponding formula column in your results for it to work:
Group by Document Number.
Create a formula (Numeric) result column with summary type of Sum using your above formula.
Create a summary criteria of type formula (Numeric) with summary of type Sum
and use the same formula and set the value to be less than 0.
This will return only records that do not include those shipping
methods.
Alternatively, have you considered running the logic (workflow/suitescript) when the record is saved and storing a checkbox value such as "Does not include freight"? It would make searches based on that criteria easier.
For example if you store the ship method on the line, something like:
// Set your freight method indexes
var freightMethods = ['1','2']
var itemLinesCount = nlapiGetLineItemCount('item');
// If a line is found with one of the freight methods you're looking for then mark the record.
for(var i = 1; i < itemLinesCount; i++)
{
var shipMethod = nlapiGetLineItemValue('item', 'custcol_shipmethod', i);
if(freightMethods.indexOf(shipMethod) !== -1)
{
nlapiSetFieldValue('custbody_includes_freight', 'T');
break;
}
}
If you store the ship method only on the item record it can be a bit trickier to manipulate (due to the way Netsuite handles item record types).
Does the line being returned have a freight value or are you getting another line from the same order?
I couldn't make the title clearer, but here's what I need help with.
I have a custom page type [1] for Leaders which includes 2 fields: Name, and Title. This holds the list of all leaders at the company.
I have another custom page type [2] for Speaking Events, which includes a field called Speaker to display the speaker's name and title. This field was set up as a drop-down list with data source from a SQL Query to query the Leaders data in [1].
Select LeadersID, Name, Title from co_leaders order by Name
I got it work fine - the drop-down displays a list of Name. However, what I wanted to display in the drop-down option is: Name, Title (not just Name) like below so that I only pick one and have both Name and Title. Is it possible to do this?
John Doe, CEO
Jane Doe, CFO
Hope it's clear and thanks for your input!
This is the SQL you are looking for:
SELECT LeadersID, Name + ', ' + Title FROM co_leaders ORDER BY Name
You need to do a concatenation of the column values (Name and Title), as opposed to selecting the columns separately.
EDIT: This is assuming that Name and Title are not nullable fields.
If there is a NULL value in any of the concatenated fields, the end value will be NULL. In this case, you will need to use COALESCE (or an equivalent function) to define an alternative value. For example:
SELECT LeadersID, Name + ', ' + COALESCE(Title, 'Member') FROM co_leaders ORDER BY Name
Problem
I have two queries, one contains product data (data_query), the other (recode_query) contains product names from within the data_query and assigns them specific id_tags. id_tags are also column names within the data_query.
What I need to achieve and fail at
I need the data_query to look at the id_tag of the specific product name within the data_query, as parsed from the recode_query (this is already working and in place) and input the retrieved value within the specific custom column cell. In Excel, I would be using INDEX/MATCH combo:
{=INDEX(data_query[#Data];; MATCH(data_query[#id_tag]; data_query[#Headers]; 0))}
I have searched near and far, but I probably can't even spot the solution, even if I have come across it, as I am not that deep in the data manipulation and power query myself.
Is this what you're wanting?
let
DataQuery = Table.FromColumns({{1,2,3}, {"Boxed", "Bagged", "Rubberbanded"}}, {"ID","Pkg"}),
RecodeQuery = Table.FromColumns({{"Squirt Gun", "Coffee Maker", "Trenching Tool"}, {1,2,3}}, {"Prod Name", "ID2"}),
Rzlt = Table.Join(DataQuery, "ID", RecodeQuery, "ID2", JoinKind.Inner)
in
Rzlt
I'm modifying an existing Lotus view to include a field from another form.
I first appended a new column and set it to the desired field. However, after I refreshed, the new column was blank even though I know it has data.
I then updated the View Selection formula from:
SELECT Form = "A" & StatusIndex < "06"
to:
SELECT (Form = "A"| Form = "B") & StatusIndex < "06"
Still no luck. The view is refreshing successfully, but the new field is still blank. What else is there to add this new column to this view?
This is my first time experimenting with Lotus, so if I seem to be missing some major concept, I probably am.
Edit
If I was pulling this data using SQL, the statement would probably be something like:
Select A.* , B.*
from A inner join B on A.id=B.id
where A.StatusIndex < "06";
Which brings up another question: Where is the relationship between these tables/forms defined?
Unfortunately, there is no (intrinsic) "join" functionality available from a Notes view. If you absolutely need the different columns appearing in the same row (document) in a view, then one option is to de-normalize the data, such that upon saving of "Document B" you update the related "Document A" with the necessary field values. (This is also the only real way to get full-text searches to work across "joined" data).
If the view is for display on browsers only, then you may have other options, such as making AJAX calls to load the related data fields, etc.
Here's a trick for adding multiple forms. This way you can easily add to the list of forms allowed without lots of OR statements.
#IsMember(Form; "A":"B") & StatusIndex < "06"
What I would try next, though, is to get rid of all conditions in your view and just show Form = "B", assuming the B form has the field you added in step 1. If that works, then you know it is just an issue with the view selection formula.
Also you can use the Document Properties to inspect document items. File > Document > Properties gets you there. I would triple-check that the documents that appear in that view do in fact have some data for the field in step 1.
Lastly, make sure the programmable name for the column in the view is unique. Double click the column header in the view designer, and then click on the last tab (beanie hat). The name that is there usually will be the same as the field you want to show in the column, or it will be a $number if the column value is a formula. You can change that name to something you know is unique just to be safe. The theory here is that if that programmatic name matches another column's programmatic name, then the view will not evaluate the column values and instead will used cached values, which in your case might be blanks. It's rare, but it does happen.
There is a simpler version of the 'multiple form' trick noted by Ken:
Select Form = "A":"B" & StatusIndex < "06"
or if you prefer:
Select (Form = "A":"B") & StatusIndex < "06"
This formula says: if (form = A or B) AND StatusIndex < "06"
Note: Be sure StatusIndex is Text (as you've quoted it) and the field StatusIndex with a value is included on both forms. If not, you need to fix your logic.
Plus: Documents display in a sorted or chronological order, ONE to a line, so you cannot have A & B data on a single line. It may look like:
A
A
A
B
B
B
OR
A
B
A
B
A
B
A
But never
A & B
A & B
A & B
I have predefined item combination (for example brand1|brand2|brand3 etc) in the table.
i like to collect brands and check against with predefined table data.
For example i collected brand1|brand2|brand3 then i can do get some value form that predefined table(it meets the condition).
How can i check?
brands would be unlimited. also brand1|brand2|brand3 of brand1|brand2| exist then returns true.
Okay, taking a wild guess at what you're asking, you have a delimited field with brands in them separated by a | character. You want to return any row that has the right combination of the brands in there, but don't want to return rows with, for example, brand "testify" in them when you search for "test".
You have four search conditions (looking for brand3):
the brand exists by itself: "brand3"
the brand starts the delimited field: "brand3|brand4|brand6"
the brand is in the middle of the field: "brand1|brand3|brand6"
the brand is at the end of the field: "brand1|brand2|brand3"
so, in SQL:
SELECT *
FROM MyTable
WHERE BrandField = 'brand3'
OR BrandField LIKE 'brand3|%'
OR BrandField LIKE '%|brand3|%'
OR BrandField LIKE '%|brand3'
Repeat as required for multiple brands.