How to add a field from a 2nd form? - lotus-notes

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

Related

How to Exclude a Column(s) in a Structured Reference to Table[#Data] (or similar)

I want to reference all the data in my dynamic table, except for the first two columns. My goal is to return the header of the first column that isn't blank, starting with the third column. I have the formula figured out for everything except the starting with the third column part. Is there an easy way to accomplish this? I'm thinking I might have to just do something like
`=Table[#Data] unless in the range of the first two columns'
Hoping for an easier way though.
EDIT: if my request isn't clear enough, I am looking for a formula that would produce the following exact situation in these circumstances. It must work in a table that can change size without issue, it must ignore the first two columns, it must scan a complete column of data from left to right before moving onto the next column (most of the formulas I've tried would give the result Aug-21 here), and it must return the header in basically any format.
I don't have the time to write up a full answer for this, but you should use the "From Table" button "Get & Transform" section of the data ribbon.
Then, in the query editor window, In the home ribbon, click Manage Reference.To find the position of the first non-blank column will be hard, requiring learning Power-Query language, probably something like clicking the advanced editor and adding steps like
let
Source = #"YourSourceQueryName",
ColumnNames = Table.ColumnNames(Source),
ColumnsToRemove = 2 + List.PositionOf( // PositionOf is zero-based, returning -1 if all are blank
List.Transform(
List.RemoveFirstN( // list of column names except the first two
ColumnNames,
2
),
(columnName) => List.IsEmpty(List.RemoveNulls(Table.Column(myTable, columnName)))
),
false
), // Power query is lazy, so this won't actually look at every column, it will stop when it finds the first column!
ColumnNamesToKeep = List.RemoveFirstN(
ColumnNames,
ColumnsToRemove
),
ReturnTable = if (ColumnsToRemove = 1) then
"All columns were blank!" // PositionOf returned -1!
else
Table.SelectColumns(Source, ColumnsToKeep)
in
ReturnTable
You can now use this in other queries or you can load it to your spreadsheet. Unfortunately power query doesn't refresh live, you have to either explicitly refresh the query or use the "Refresh All" button in the data ribbon.
(I stressed the word "like" because I didn't debug. May contain syntax errors or other issues for you to debug.)

Cleaning Excel Table using VBA without impacting the entire table and formatting

Hi I am trying to change to write VBA for excel to clean up data elements that has extra information without impacting the other elements.
I am writing VBA for the first time my table is in the middle of the sheet.
Given Table and Requested Output.
I think your question was not clear in regard to the "steps" that you want to perform on your data (i.e. the exact logic or transformation that needs to be applied).
Based purely on your images and your comment, I make the "steps" to be:
Split any customer IDs in column valueC into multiple rows.
If column valueC does not contain customer IDs (i.e. is blank or contains non-customer ID text), leave it untouched.
My answer uses Power Query instead of VBA. If you are interested in trying it out, in Excel try clicking Data > Get Data > From Other Sources > Blank Query, then click Advanced Editor near the top-left, copy-paste the code below, then click Done.
You might need to change the name of the table in the first line of the code (below), as it was "Table1" for me, but I imagine yours is named something else. Also, the code below is case-sensitive. So if there is no column named exactly valueC, then you will get an error.
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
fxProcessSomeText = (textToProcess as any) =>
let
canBeSplit = Text.StartsWith(textToProcess, "### customer id"),
result = if textToProcess is null then null else if canBeSplit then Text.Split(Text.BetweenDelimiters(textToProcess, "### customer id", " ###"), ",") else {textToProcess}
in
result,
invokeFunction = Table.TransformColumns(Source, {{"valueC", fxProcessSomeText}}),
expanded = Table.ExpandListColumn(invokeFunction, "valueC"),
reindex =
let
removeIndex = Table.RemoveColumns(expanded, {"index"}),
addIndex = Table.AddIndexColumn(removeIndex, "index", 1, 1),
moveIndex = Table.ReorderColumns(addIndex, List.Distinct(List.InsertRange(Table.ColumnNames(addIndex), 0, {"index"})))
in
moveIndex
in
reindex
My output table contains more rows than yours. Also, the value in column valueA, row 11 is 1415 for me (it is 1234 in your request output). Not sure if this is a mistake in your example, or if I'm missing some logic.

Excel Power Query -- Select value in column specified in related table -- INDEX+MATCH alternative

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

Filtering view in lotus notes

good day,
I'm trying to filter date by year using #setviewinfo. can anyone tell me how?
Here is an example, put this formula on PostOpen event on view. It will filter all document by column with user name.
#SetViewInfo([SetViewFilter]; #UserName; "columnName"; 1; 1)
columnName - is a real name of column (you may set it in Column Property)
Remember to clean filter on QueryClose even on view, otherwise all view will use this filter.
example how u should remove filter
#SetTargetFrame("frameName");
#UpdateFormulaContext;
#Command([OpenView]; #Subset(#ViewTitle; -1));
#SetViewInfo([SetViewFilter]; ""; "columnName"; 1)
frameName is a frame that contains view, columnName is your categorized column. If you do not use frame - simply skip 1-st row

Lotus Notes custom search

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...

Resources