Thursday, June 01, 2006

@Formula using Ajax

There have been quite a lot of articles written on how to call @Formula using Ajax. Below are two sample from searchdomino.
1. DBColumn and DBLookup for all browsers using AJAX
2. Using AJAX as a replacement for @DBLookups

I'm developing an application which needs uses quite a lot of formula (especially @DBLookup & @UserRoles of different selected person) at the client side. To port it to web, I need to use those too.

Instead of creating new agents for each @Formula, I created a formula setup Form where I can enter different formula. Each document will have a unique title (single word). I use tags (<keyn>) that will be replace by parameter pass in through url.

Using a view, I use a different form to open the document. This is set in the "Form Formula". The new form will compute the formula and return the result. In the view, set the title as the first column and sort it either ascending or descending. This way you can get the document using the title instead of document unique id

Below is a sample where different product group is selected, the products will be retrieved (DBLookup) and populated into the Product selection list. Check out previous post on dynamic selection list.

I use AJAX to call the formula document

The param is optional. That will return the result in text format. You can then process it as needed. If you need more formula just create a new setup formula document and you are ready to use it. You can download the sample db here.


Anonymous said...

This is great! I've been trying to do this exact same thing (populating drop-downs based on preceding fields) using prototype.js on Domino with no success. Now I know how, Thanks!

William Beh said...

@chris. Hope you find the writeup useful. It's codes are still in early stage but it's working. Still a lot of room for improvement.

Patrick Kwinten said...

thank you for sharing, I was just looking for an example :o)

Tan said...

Thanks for the writeup. I attempted to download the code, but the server seems to be down for the past three days.