Select clause editing in RedQueryBuilder - 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.

Related

Table with variable number of rows in MS Office mail merge [duplicate]

I'm creating a compliance mailing for my organization, the mailing will include merge fields that identify the office location, physician, and SiteId. The mailing will also include a table of information that is dependent upon the particular SiteId.
I'd like to use the import table function of MS word and set up a query that references a merged field (SiteId) so that the inserted tables populate the appropriate data for the particular site. I'm unable to do this.
How can I set up this document so that I can import only records from my source (an ms access query) that match the SiteId merge field?
Word's mail merge does not support one-to-many relationships. There are ways to coerce it, but only one of them can yield a table as a result and over the years it has become less and less reliable as Microsoft has not regarded it as important enough to maintain...
What you need to do is set up a query that provides ONLY the information you want displayed in the table, plus the key (SiteId). It's best to sort it so that all the SiteId entries list together, and are in the order the data will come through in the mail merge data source.
On the Insert tab go to Text/Quick Parts/Insert Field and select the Database field from the list in the dialog box. Click "Insert Database" and follow the instructions in the dialog box to link in the data. Be sure to set the Query Options to filter on the first SiteId from the data source. When you "Insert Data" make sure to choose the option to "Insert as a field".
This inserts a DATABASE field in the document which you can see by toggling field codes (Alt+F9). The field code can be edited and what you need to do is substitute the literal SiteId value you entered for the query with its corresponding MergeField.
When you execute the merge to a new document that should generate a table for each data record corresponding to the SiteId for the record. But, as I said, Microsoft hasn't done a great job of maintaining this, so it may require quite a bit of tweaking and experimenting.
If the results are not satisfactory then you should give up the idea of mail merge and use automation code to generate and populate the documents.
You can find more (albeit somewhat out-dated) information on this topic at http://homepage.swissonline.ch/cindymeister/mergfaq1.htm

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

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.

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.

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.

How can I hide a table in a particular database?

In my database I have a table called Price.
I want to hide this table. Is this possible ?
If the user does not have SELECT permissions on the table then they will not be able view the table in Object Explorer.
i.e.
deny select on TableToHide to UserThatShouldntSeeTable
go
Depending on your particular circumstances, you may be able to use the Tables "filter" functionality. You can filter your list of tables in the Obj Explorer to view only those tables that satisfy certain criteria. (Unfortunately, you cannot HIDE certain tables, you can only SHOW certain tables, while hiding all others.)
To do this, simply r-click on the "Tables" node, and select Filter -> Filter Settings. This opens a dialog which allows you to specify the criteria (name, owner, date of creation, etc) by which you want to specify which tables should be visible. More details can be found in this post.
It's too bad you can't save filters (based on schemas, for example), but at least it's a start.
[Now if only we could do the same thing with the list of Databases on shared servers...!]

Resources