I have an app that is using one repeat control inside of another repeat control. The outside control uses a simple DbColumn to capture data from a view column. I have a computed field to display the list from the repeat control. The inside Repeat control uses a simple DbLookup based on the list from the outside repeat control. I display that data using a link. The issue is, The repeat control that uses the DbLookup will not display the corresponding data from the outside repeat control unless there are a minimum of two documents to display. If the outside control lists Company A, and there is only one purchase order document associated with Company A, it won't display. As soon as you create a second document for Company A, both documents display as designed. This is happening on two separate apps I'm working on. Is there something I'm doing or NOT doing?
This is because #DbColumn() doesn't return an array if there's only 1 result - instead it returns a string.
I will recommend that you use this improved version of DbColumn and DbLookup that handles this and more - including support for caching:
http://openntf.org/XSnippets.nsf/snippet.xsp?id=dblookup-dbcolumn-with-cache-sort-and-unique
Wrapping the #DbLookup / #DbColumn in an #Explode may solve your problem. #Explode should return an array.
Related
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.
We have a set of BLC/DAC for a customization that has multiple tables with the given relationship
Table1 - T1ID (int-autoincrement), T1CD (char-substitute key)
Table2 - T2ID (int-autoincrement), T2CD (char-subsitute key), T1ID (reference to T1ID)
where the records in Table2 are unique for each given T1ID selected.
The initial design specification was for the users to select first the Table1 value, then the Table2 value (UsrTable1Value, UsrTable2Value respectively) in the data entry screens.
The users have recently asked if it's possible to combine these into one field simular to a Dimension selector so that there is one field resulting in "Table1-Table2" stored as T2ID.
My first thought was to simply create a subclassed dac with a concatenated property for T1CD-T2CD and base the substitute key off that however performance is a problem when that is done (1.6 million records). The delay is in the framwork side as it appears it processes the entire recordset when generating the concatenated substitute key.
Based on that I thought perhaps instead to simply generate a PXDimension configuration for this however I can't find any reference to make Dimension 2 rely on the value of Dimension 1.
I know i could always create a view that does this but i'd prefer to keep it within the framework if possible.
That basically brings me to two questions
1) Outside of a view, is there way to concatenate fields in the BQL so the lifting is done on the SQL and not with a calculated property?
2) Does anyone have or know of a sample of custom Dimensions where the values in level 2 depend on the value in level 1?
Any suggestions would be appreciated.
Out of the box, dimension selectors are designed to work only with Segmented Keys and won't be able to handle values from multiple tables. In theory, it can be possible to populate segment popup from different tables within a custom DimentionSelectorAttribute. However, this will additionally require to store each T1ID/T2ID pair in a separate table with some other column declared as a key (same concept used in the Sub table to store sub accounts: SubID is a key and SubCD stores values composed from multiple segments).
My personal opinion, the effort is just not worth it. Going one step further, I would check with the customer on how they expect navigation buttons (first, prev, next, last) to work with their segmented input control? If following standard Acumatica UI design with separate input created for every key field, no additional effort is needed to properly handle both data entry and navigation.
I am trying to create a categorized view of all Notes documents that have a field with exact same value, i.e. there is a field for Contractor Name and I want to create a view that lists each Contractor and the documents that relevant to each. How do I do this? I have tried view formulas like the following but no success as yet
SELECT #IsAvailable(Contractorid) & #Count(Contractorid) > 1
SELECT #Count(#IsAvailable(Contractorid)) >1
Nsf databases are no relational databases. The count of different documents with a unique value in a specific field cannot be used to build a view selection formula.
You could write an agent, that runs through all documents and counts them and puts all with count > 1 in a folder, but this is quite a lot of LotusScript code and needs some advanced knowledge.
The other possibilit would be to categorize the view by ContractorId and add one column before that categorized column: simply use 1 as column formula and select "display totals" in the column properties as well as "hide details".
Then at least you have the information, how much documents are in each category, but unfortunately you cannot filter by it and you cannot sort by this column.
A third possibility would be to use an xpage interface, but that is even more work to do and a completely different story developmentwise.
This is similar to view to identify duplicates. My approach is to use folder.
Make a new folder with design of your view. Instead of (not working) selection formula use short LS code as an action, or QueryOpen event (make sure only one user runs the script).
The code should cooperate with another (hidden) view sorted by Contractorid. Make a ViewNavigator for that view and traverse through it with simple logic - if previous entry has the same Contractorid as the current one, put both documents into folder**. That way you will get list of all documents with duplicate Contractorid. Make sure to wipe all the current content from the folder at the start.
** This can be optimized further by slightly more complicated algorithm to handle first duplicate diferently - for more than two duplicates this algorithm makes extra calls of PutInFolder method.
How do I add fields to the view when merging records?
All fields on the last used form are used for merge function, you don't have to do anything specifically other than making sure they are on the form.
The fields are always filtered and only shown if one or other of the merged records contains a value - this avoids wasting time and screen real estate asking users to select between two blanks, so they more easily see the fields that are different. Bit fields (two options) are included since they always have a value of 0 or 1.
See this page for some practical tips as well:
http://blogs.msdn.com/b/emeadcrmsupport/archive/2013/12/18/dynamics-crm-2011-merging-records-issue-with-multiple-forms.aspx
I've been finding the answers I need here on StackOverflow for months (thank you all!) but so far my search terms aren't finding the result I need this time... hence, my first post here...
I have an Excel file that includes two UserForms:
The first is used to input certain invoice data and then export that data in a format that can be uploaded into our proprietary accounting system.
The second is later used to post payment data against those invoices and then, similarly, export that data in a format that can be uploaded into our accounting system.
The second form has to be created dynamically in Userform_Initialize, because the number of payments required (and, thus, the number of TextBox and Label controls created) varies depending on the size of the invoices. I've finished the code to create this second form and it works well, but I'd like to add some functionality that is triggered when some of these dynamically created controls are changed by the user.
I've done this in other forms using a given control's _Change() procedure (for example, when I want to move to the next box after entering a dollar amount, I use _Change() to SetFocus elsewhere as soon as the value has two digits after the decimal). So my question is: how can I establish _Change()-style procedures for controls that don't yet exist before the form is initialized? Is there a way to set a "global" _Change() procedure that I can use to loop through text boxes and use if/then/else statements based on their dynamic names?
Any tips would be greatly appreciated!
When I am using dynamic forms, I like to create object arrays to store the relevant information so that I can quickly and easily reference the objects by "name".