This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Aug 1, 2013, 8:43 PM
11 Posts
topic has been resolvedResolved

Database as a Data Source

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags: data source
  • Replies: 6

Is there a way to define Database as a Data Source inside xPage? I can see Document and view as data source but I don't see database ( I mean other databases ) as a data source. Can you please explain how to define database as a data source and use it in xPages.

Aug 1, 2013, 9:34 PM
10 Posts
One method

Here I'm setting the database using a applicationScope variable.

    <xp:this.data>
        <xp:dominoDocument var="document1" action="openDocument">
            <xp:this.databaseName><![CDATA[#{javascript:return applicationScope.get("DBSource")}]]></xp:this.databaseName>
            <xp:this.formName><![CDATA[#{javascript:return "XXXXXXX";}]]></xp:this.formName>
        </xp:dominoDocument>

applicationScope variable value is

applicationScope.DBSource = server + "!!" + dbpath;

so to define database source is <Server Name> +"!!" + <database path>

Hopefully this example answered your question

Bob

 

Aug 2, 2013, 6:04 AM
54 Posts
Database source

I think there´s no need to define a database data source. What kind of data do you want to get from?

Aug 2, 2013, 8:12 AM
30 Posts
datasource

As far as I know, data sources can be view or document. If your view(or doc) is in another base, you can reference it like this:

 

<xp:dominoDocument var="document1" databaseName="NameOfAnotherDatabase.nsf"
            formName="FormName">
        </xp:dominoDocument>

 

Now you can work with this datasource as if it were in your own database.

Hope that helps!

Aug 2, 2013, 1:43 PM
11 Posts
Database as a Data Source

Thank you all for your quick response. Following is my requirement :

I have all my keyword documents in one central database in multiple views.

I could define multiple views as data source and get values based on a key. Is there any way to define DB as data source so that I do not have to define too many views as my data sources? The examples you have given were specific to document, I don't think I can get something like db(datasource).getView("vName") with the document data source ...

Please share your thoughts..

Aug 2, 2013, 2:01 PM
586 Posts
hmmm

Do you need the Documents in this central keyword database?  Or just the values?

I'm not typical, but to my a central keyword database usually has things for looking up values for comboboxes and other pickers and stuff...

So a view might look like this:

Color

   White

   Black

   Red

 

Material

   Brick

   Wood

   Stone

 

Now if I want to access these VALUES I would not find to that db and view but have a SSJS function to go get them and return a list..

var results = getKeyWords(key:string) 

 

Something like that...  

If I wanted to really get the documents I'd still use a function and return a document collection or something to a repeat control maybe...  

 

So I guess it depends on what you want to do with the data in this central database.


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal