jump to article
...intermittent thoughts

News on @WebDbName for XPages

Last week I posted some reusable, hand crafted @Function for XPages. Well there was a small mistake in it, I did not realize earlier. @WebDbName is written differently :-) So here is pretty much the same function - with correct spelling of the name:

/**
* provides functionality of the function with same name from @Formula
*
* @return the name of the current database in a websave format
* @author Michael Gollmick
* @version 1.2
* @date 20090127
*/
function @WebDbName() {
        try {
                if (typeof this.name === 'undefined') {
                        var path = database.getFilePath();
                        var re = new RegExp("\\\\", "g");
                        path = path.replace(re, "/");
                        var arr = path.split("/");
                        for (var a = 0; a < arr.length; a++) {
                                arr[a] = escape(arr[a]);
                        }
                        this.name = arr.join("/");
                }
        } catch (e) {
        }
        return this.name;
}

Besides of that correction of the spelling, I am thinking about a potential problem: what if IBM is releasing a newer version of their @Formula library containing an implementation of @WebDbName? Well, applications relying on this solution should run, since the custom function declaration should overload the initial definition - but what if such a potential native implementation works somewhat differently? That would be horrible for anyone who attempts to maintain legacy code, relying on an implementation as I just showed up above. One possible solution would be to name such functions differently. Well, that would work but would not be that easy. How to make such functions better remarkable to those who are getting used to XPages and come from an @Formula background? Daniel mentioned, to add some suffix to the function name, so that would probably be @WebDbName_MGO(). Good Idea, but I think this will look odd in the code. My current thoughts tend to rename this function to $WebDbName() and name future other implementations of known @Formulas also with a $ symbol at the beginning. They would then become the $Functions ;-)
  1. 1) Patrick Kwinten said: (08.03.2010 19:14:38 GMT)
    thanks

    thanks for the code, I was just looking for it...

  2. 2) cialis_10mg said: (27.02.2017 14:00:51 GMT)
    cialis 10mg

    Hello!

    { Link } , , { Link } , , , , h{ Link } , ,

  3. 3) writing said: (03.04.2017 23:24:19 GMT)
    academic writing assistance agencies

    Hello!

    { Link } , , { Link } , ,

  4. 4) envío said: (05.04.2017 16:03:17 GMT)
    viagra envío inmediato

    Hello!

    { Link } , , { Link } , ,

  5. 5) viagra said: (05.04.2017 16:03:18 GMT)
    generic viagra india pharmacy

    Hello!

    { Link } , , { Link } , ,

  6. 6) sales said: (06.04.2017 3:19:44 GMT)
    viagra sales 50mg

    Hello!

    { Link } , , { Link } , ,

  7. 7) is said: (06.04.2017 3:19:44 GMT)
    safe is viagra

    Hello!

    { Link } , , { Link } , ,

  8. 8) writers_help said: (09.04.2017 19:51:57 GMT)
    writers help

    Hello!

    { Link } , , { Link } , ,

  9. 9) viagra said: (14.04.2017 7:40:56 GMT)
    is viagra prescription free,

    Hello!

    { Link } , ,

  10. 10) cialis said: (20.04.2017 2:41:57 GMT)
    buy cialis online

    Hello!

    { Link } , ,

  11. 11) a said: (20.04.2017 2:53:29 GMT)
    find a specialist

    Hello!

    { Link } , ,

  12. 12) best said: (25.04.2017 3:55:15 GMT)
    cialis best prices

    Hello!

    { Link } , ,

  13. 13) cialis said: (09.05.2017 11:31:29 GMT)
    cialis

    Hello!

    { Link } , , { Link } , , { Link } , ,

  14. 14) cialis said: (27.05.2017 20:04:57 GMT)
    buy cialis online

    Hello!

    { Link } , ,

  15. 15) James said: (18.09.2018 15:37:29 GMT)
    James

    Some really nice and useful information on this web site, also I conceive the style and design holds superb features.

  16. 16) 더킹카지노 said: (22.11.2018 14:52:55 GMT)
    News on @WebDbName for XPages

    https://custory.com/theking/ - 더킹카지노

    https://custory.com/woori/ - 우리카지노

  17. 17) 더킹카지노 said: (22.11.2018 14:53:49 GMT)
    News on @WebDbName for XPages

    https://pauio.com/theking/ - 더킹카지노

    https://pauio.com/woori/ - 우리카지노


Add Comment
 
Subject:
   
Name:
E-mail:
Web Site:
 
Comment:  (No HTML - Links will be converted if prefixed http://)
 
Remember Me?