FORUM PLAN UPDATE
Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.



Oct 8, 2015, 6:18 AM
24 Posts

Xpage Calling Agent/Form

  • Category: Dojo and Client Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role:
  • Tags:
  • Replies: 6

I am having an requirement, to show the data on Xpages, and the data will be fetched from Oracle Database. For that I have written an agent in Lotus Script, it's working fine.Now my problem is I have to show 3 fields in Xpages, field no 1 user can Input some data like part no after putting the part no the data should automatically come to Field 2, and Field3.Please help me how should gather this.I am totally new to xpage.

 

Some of my lines in agent

qry.SQL = "select * from od2 where Part_NO='4000000710(here I will pass the input field name)'"

result.Execute

If result.IsResultSetAvailable Then

msg = "Contracts:" & Chr(10)

Do

result.NextRow

Quantity = result.GetValue("Quantity", _

Quantity)

Contract = result.GetValue("Contract", _

Contract)

Part_no = result.GetValue("Part_no", _

Part_no)

Loop Until result.IsEndOfData

Oct 8, 2015, 10:53 AM
453 Posts
Well first...

I would do this in Java or SSJS. 

I'm not much on the SQL side but I would seriously look at creating a say viewScope variable that you load with the returned Quantity, PartNumber etc. With each returned row as am element in the viewScope. ie in Native Notes terms the viewScope is a multi-value array of complex type, ie a Java Class. Then make this viewScope the dataSource for a repeat control on your XPage. 

I would seriously consider doing this all in JAVA, might take a bit more time the first time but think it would pay great dividends in the long run. David Leedy has a video on Notesin9.com on doing the JAVA side (think it is episode 182 but not sure). In his Demo he is getting the values from Notes documents where you would get them from your SQL query.

Oct 9, 2015, 7:52 AM
24 Posts
Xpage Calling Agent/Form

But  I have already create dthe agent in Lotus script.I don't have any idea of java.My question is can we run the lotus script agent from xpage.Please help
 

Oct 9, 2015, 7:52 AM
24 Posts
Xpage Calling Agent/Form

But  I have already create dthe agent in Lotus script.I don't have any idea of java.My question is can we run the lotus script agent from xpage.Please help
 

Oct 9, 2015, 12:39 PM
453 Posts
LS does not run on the web

There are ways to run LS as a backend using SSJS

var agent:NotesAgent = database.getAgent("Your Agent Name");
            agent.runOnServer();

Converting LS to JS is not a really difficult issue. The syntax is a bit different but very doable. 

I do a fair bit with LS agents but they are all scheduled agents that run against the back-end with no user interaction. I probably should rewrite them as JAVA, but they are kind of legacy code and it would be a very big job. However, SSJS and Java are the way to interact with the user. 

If you want to use XPages then you had better get on the SSJS and Java track. There are a number of specific XPages on-line courses on SSJS and Java, plus Dave Leedy has several videos at http://notesin9.com 

Take the time now, it will save you a lot of time later.

Oct 9, 2015, 3:02 PM
589 Posts
hmmm

B Dali,

Yes you can run an Agent from XPages.  It's not a "best practice" but it's possible.  Performance will suck if it's a busy website.

I've never done it so I can't help you how.  

You should try and use Google.com first.  I did a search for "call agent from xpages" and found a lot of good looking links.

 

Good Luck


FORUM PLAN UPDATE
Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.