I am using extension library Rest controls ViewJsonservice to provide the data from Notes database, is there a easy way using same control I can provide the data from two databases, I can put the similar view from dbA to dbB
Short answer: no
Long answer:
I presume you want the data from 2 views available in a single endpoint. Either after each other (appended) or somehow merged.
You can do that using code. Check this article for basic info.
In a nutshell: use the ViewNavigator class in both databases to retrieve results and append or merge the data before you return it.
Nice side effect : you can return all the data.
Related
My question is pretty simple. I am working on Kentico 9 with its SQL Server database which contains several tables which had been added directly from the SQL Management Studio by an external contractor. The fact is that those tables are being used to store custom content which will be displayed for a site, but, in the code they don't have the code for making queries. I mean, they don't have Info and Provider classes.
https://docs.kentico.com/display/K82/Retrieving+database+data+using+ObjectQuery+API
According with this, all tables into the Kentico database can be accessed by invoking methods on these classes, but I don't have it this time.
Something like this, it will not work if I use my table name:
var user = UserInfoProvider.GetUserInfo("administrator");
var items = CustomTableItemProvider.GetItems("MyTable")
.TopN(10)
.WhereEquals("ItemCreatedBy", user.UserID)
.OrderBy("ItemCreatedWhen");
My question is:
can I query any table by its name?
One last thing:
I cannot declared those table as "custom table" because it seems to be a bug in the CMS.
Or you can pull data using your own SQL query:
var ds = ConnectionHelper.ExecuteQuery("select ....", null, QueryTypeEnum.SQLQuery);
Nevertheless I would recommend to create a custom class inside a custom module (much more robust than custom tables) instead and use the generated Info and InfoProvider classes to get and manipulate data.
I think an object has to be registered within the system (created through Kentico UI or API) in order to be pulled from DB with object query.
So I'd choose one of the following options:
Use Entity Framework or something similar to work with that data
Create appropriate custom tables or even custom module and push data there. Not sure why you can't create a custom table... What is an error you're getting?
If you need to present data on the UI only (without processing on the back end) - use just custom queries
Hope this helps.
If you are accessing in code then you could do it the good old fashioned way. If you want to pull data from the database to display on the website you could also do so by creating a custom query and using a transformation to display the fields, then use a repeater on the page to display the transformed data. Alternatively you can use a SQL datasource with a basic repeater, but you still have to create a transformation to display the data. Both methods allow you to access the data in the tables from within the CMS UI, no need to touch any code behind.
If your objective is to read data from these database tables to transform on webpage e.g. using CMS Repeater webpart, you can simply create custom query(s) in Kentico itself and load data using it. You can find the detail here on how to create custom custom queries and load data using it.
On the other hand you can also write your custom classes and define the custom methods where you can pull data using your own SQL query like this:
var ds = ConnectionHelper.ExecuteQuery("select ....", null, QueryTypeEnum.SQLQuery);
Lastly I don't think there should be any issue to create custom table instead of those direct DB tables, only thing we have to ensure code name of custom table should be unique means don't try to use exact same name because it'll cause exception due to same table name already exist in DB. You can please share exception you getting while creating custom table so that I can help you out further.
How to access a connector / Data Base from the initial/instantiation Form/Page?
Hi every body, any help will be appreciated.
I try to access using the API Rest, but the method need the activyty/task id or the instance flow id.
This is because the connector stores its result in a proces/local/Busines data model or Variables,
but in the initial form I don't have an
instance of the flow/task/activity and I can't access to the variable that stores the value.
I need to use the connector to access data base and to the Ldap
to get some values to show in the initial form before instantiating the process.
Is there any way to call a Groovy Script from initial Form?, if there is,
I can access from that script to the data base, and save this value into a form variable, to show it in the form I think.
P.S.: I use Bonita 7.2
thanks!
Sounds like you have a chicken and egg problem.
Can you instantiate the process with minimal data, then use a connector out to populate the BDM with the connector data, and then make the first step of your process the "initial" form? At that point you then have the case, taskid, etc.
If the data is not task/case specific, you can access the BDM data via the REST API and a custom query - i.e. you're not just limited to the API's that require the case/task/instance, etc. However, you may need to get clever with how you isolate that record. For example, I have some global parameters that I keep in in the BDM, and access them within my form by requesting the first record in that table via the rest API:
I created a variable called "globals" of type "External API" with the following REST call that retrieves the record with persistenceId=1:
../API/bdm/businessData/com.company.model.GlobalParameters/1
In your case, you probably need to use a REST Api extensions. Basically, you can create a new REST Endpoint using Groovy script. There is a documentation available here: http://documentation.bonitasoft.com/rest-api-extensions-808
Cheers
Is it possible to associate a view with different documents (not simultaneously of course)?
What I want to achieve: the application can have multiple documents of the same type, that can be added during runtime, and set of suitable views, the main of which is CFormview-based. The user can choose the number of the document to show per combobox in the toolbar. The views then associate themselves with this document and update with data from it.
Is it possible to achieve with CMultiDocTemplate?
If yes, how? especially is it possible to retrieve a document by it order number?
If not I'll probably have to abstain from using the templates altogether, which of course means more coding (and more questions to friendly community), but it will do what I want it to do and not Microsoft thought I should be doing
Yes, you could but not out of the 'box'. Instead I'd recommend a different strategy. Rather than trying to attach a View to an existing CDocument derived class LOAD the Views CDocument with the information you want. That could done by adding a simple Copy method to the CDocument or you could move your actual data into a separate class then just point the CDocument to 'data' you want.
Trying to change the CDocument instance for a CView is going against the MFC grain which normally means lot of ASSERTS.
I have 2 forms and the data should be stored in the record store only after filling all the fields in both the forms and if we switch from one form to another the fields in the form should contain whatever the user has entered. So how do I store the previous data and auto populate it when he switches from one form to another?
You need to indicate whether you are actually using LWUIT manually to build the form or using the GUI builder. Also the answer for 1.4 differs from the answer to 1.5.
If you are using LWUIT 1.5 just use LWUIT4IO's Storage classe's writeObject method. Create an object that implements the com.sun.lwuit.io.Externalizable interface and contains your data. You will need to register it using the LWUIT4IO Util class.
There is a sample for serializing data within the Tipster demo in LWUIT, it stores hardcoded and modified data into storage.
If you are using 1.4 just go over the RMS API. Not the most intuitive API in the world but usable for storing data.
You can get the values from RecordStore and populate that values into another Form. Look on the following article for how to read/write/update the record's into RecordStore.
J2ME record management system
Update record's in record store
RMS basics
you can have one public DataObject Class.
Now Create getter & setter public method in it and access them from anywhere in the project.
Has anyone been able to use a SubSonic generated collection as a "business object datasource" with Microsoft report (rdlc)? I have generated the SubSonic class code but for some reason the report datasource window is not seeing the class as a potential object collection datasource.
Is there something I need to do for this to work?
Thanks in advance...vsdotnetguy
I have loaded Reporting Service reports from business objects before (loaded via NHibernate -- which isn't exact but close enough for argument sake).
Couple of key points:
1. return your objects in List, even if you are only returning one object.
2. You want FLAT business objects. You might have to go thru a DTO transformation to get that. By flat, I mean the most complex property you can have in a business object is a string and a number (int, decimal, double). If you are expecting to grab a value like this:
myObject.Customer.Name, forget it. Create a CustomerName property.
3. If you need data from multiple places try to break up your reports into subreports. You key off of the datasource key to figure out what data to return to the report.
I'll add more as I remember, it has been a few months since I've done this.
Yes I've done it, you should only need to make sure the project containing your reports references your SubSonic project (obviously :).
Sometimes I've also found that Visual Studio can get a little borked and require a restart before repopulating the datasource window with SubSonic generated objects.
Thx Chris and Adam,
Here is the answer I found.
In my case I wanted to dynamically set the main and subreport datasources at run time using the SubSonic object collections. However, I also wanted to design the report layout using drag and drop of the datasource columns.
But I was unable to design the report using drag&drop because none of my SubSonic collections were showing up in the Website Data Sources.
However, later while I was doing some control binding using the ObjectDataSource control, I noticed that NOW my SubSonic collections were showing up in the Website DataSources window and I could drag and drop the report layout.
So if you are dynamically setting the report datasources at run time and ARE NOT using the ObjectDataSource control already in your project, you MUST add a dummy ObjectDataSource control to one of your aspx pages. This will then make the business object datasources show up in the report designer.