How do you view the table structure for the relational data used in XPages JDBC? - xpages

The XPages JDBC application uses the derby1 connection and the examples show being able to sort the columns in ascending/descending order. The design elements show the column headings with sortable="true" which is what I have in my app, but my columns won't sort. You can see a table structure using the Table Meta Data listing, but that doesn't say if the data element is indexed. Our DBA says that the index doesn't allow/disallow sorting and that I have to use the order by.
So, how is sorting being accomplished in this application when there is no event tied to the columnheader?

Your dba is right, you can order by a unindexed column (use ORDER BY YourColumnName in your SQL statement). Both datasources (JdbcRowSet and JdbcQuery) allow you to specify sqlQuery parameter, which can contain this clause. Unfortunately you cannot use sqlParameters properties for sorting (this is probably because java.sql.PreparedStatement does not allow you specify an ORDER BY parameter).
On SSJS side, you can use #JdbcDbColumn() function, which allows orderBy as fifth parameter, or use your own SQL statement with #JdbcExecuteQuery.

Related

Concatenated SQL fields in selector and/or custom PXDimension

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.

Select clause editing in RedQueryBuilder

I'm looking into using RedQueryBuilder for a web-based query builder. I want my users to be able to specify what data they want to retrieve in the select clause, but the demo site
only shows selecting a single table, rendering all the columns of that table in the result. Does RedQueryBuilder support building out a more robust select clause, like specifying which specific columns to retrieve including those joined from other tables?
I'm afraid not. The project just concentrates on defining a query to return rows not what to show in those rows.
The onTableChange callback would feed you the list of tables in the expression so could go from that to a list of available columns...
Would you want/need to alter the SQL query generated or just the display of the results?
Personally I'd be interested in changing the demo into a more useful query too although the scope of that could be huge.

Filtering a repeating table linked to a secondary datasource

I have an infopath form based on a sharepoint list (worktracker).
In that form there is a repeating section which holds data from a secondary source which is the worktracker list again.
I would like to filter that table using the value in a field on the form - this enables me to run a check on duplicate items on the list by using a calculated checking reference.
I have done this by using conditional formatting to hide the non-matching items but that this killing my form as IE throws tantrum as it takes too long.
Does anyone know another way to do this? I am stuck using IE8 - not my choice!
UPDATE:
So since posting the above, I had since tried using a REST connection which doesn't work as my list is too big. I have also tried using an XML connection to a filtered view and that didn't work either!
Cheers,
In the form, select the value field. Create a rule that sets the secondary data source's query field of the same name to that value. Then query the secondary data source. It will only return the items where the value matches.

How does CRM 2011 auto-wire the StringMapBase table in for Option List picks in Advanced Finds?

The StringMapBase SQL table is the table that holds Option List values that have been added to an entity. When using an Advanced Find in CRM 2011, if you select a pick list column (Option List) value from an entity to be added to the resultset, the Advanced Find mechanism somehow auto-wires in the string value of the pick list from the StringMapBase table instead of showing the StringMapBase's Primary Key value that's actually stored on the record.
I'm in the process of creating SSRS reports that hinge on some Option List values:
// SQL psuedocode
Select...
...
Where Value = 'Some String Value of Interest'
However, I very much dislike the fact that, so far, it looks like I basically have to write in some ad-hoc SQL in order to get the applicable StringMapBase value. In order to do so, I have to hard-code some magic values, which I despise.
Does anyone know by what mechanism the CRM Advanced Find engine auto-wires these values in? Or does it simply do its own join to the StringMap system view or use a SPROC somewhere?
When you use the Filtered views (the only supported way to read data in your report) there will be an additional "logical" column for Bit, Picklist, and Lookup columns. For an attribute named "new_option" you should be able to add "name" to the end of the column name and query "new_optionname".
select new_option, -- Integer
new_optionname -- StringMap joins generated by Filtered Views
from Filterednew_test

Portal displaying data from two tables

I have two tables which both include a date field. Currently I have two portals, one for each table (occurrence).
Is it was possible to display the results of both of these in one portal, and sort by the date?
Technically a portal can only display records from one table. If you need to join two tables then you have to do this manually or change the design and use one table instead of two (since you want them in the same portal, then the tables are similar to some degree; maybe this similarity can go into its own table).
Sometimes developers use the so-called virtual table technique: they create a table with, say, a field with the record number and a bunch of calculated fields that pick their values from elsewhere, for example, from prefilled global variables. They create a portal to this table, set up the relationship to display the required number of records, and write the code to fill these variables. This way they can show data that isn't stored in any table, combine tables, etc. But it's an arcane technique, I would recommend it only as the last resort.

Resources