Andrew Pollack's Blog

Technology, Family, Entertainment, Politics, and Random Noise

Domino Technote - Undocumented function plus cool code lets you get the current location name, thus any data from the current location in pure formula language.

By Andrew Pollack on 07/01/2006 at 11:24 PM EDT

I don't post technotes like this often, but rest assured fans of mine, the old man still knows a few things. Someone we all know and love was bouncing a problem off me. He needed to lookup the currently active location document name. @Environment wouldn't work because you can't lookup non-user variables. The tricky part is that it had to be all formula language.

He tipped me to an undocumented function "@LocationGetInfo". After dumping the mail6.ntf and pernames.ntf to dxl, I came up with only a few parameters for that function.

@LocationGetInfo([HomeServer])
@LocationGetInfo([InternetMailAddress])
@LocationGetInfo([NamePreference])
@LocationGetInfo([BookmarksFilename])
@LocationGetInfo([SametimeServer])

None of these did what we wanted. After some hacking and a little educated guesswork, I came up with this one:

@LocationGetInfo([UNID])

That was magic. Once we had that, I quickly wrote this formula to get the name. With the name, you can lookup any field on the document of course.

n := @Text(@LocationGetInfo([UNID]));
locList := @DbColumn("":"NoCache" ; "": "Names.nsf" ; "Locations"; 1);
@For( x := 1 ; x <= @Elements(LocList) ; x := x+1 ;
t := @DbLookup("":""; "":"Names.nsf"; "Locations"; @Subset(@Subset(loclist; x) ; -1) ; "Name" ; [ReturnDocumentUniqueID]);
@If(n = @Text(t) ; @Do(@Set("LocationName"; @Subset(@Subset(loclist; x) ; -1) ); x := @Elements(loclist) + 1 ) ; "")
);
@Prompt([Ok];"";LocationName)

Looking at this, the first line gets the unid of the current location. Next, we get a list of all the locations. Then we lookup each location in order and check the unid. When we have a match, we set the value of the name to our internal variable "locationName" and then also set x to larger than the list of locations so we don't do any more lookups than we have to.


  • car icon

    On Site Training

    We can bring the same kind of top quality training you get at conferences right to your offices. If your team needs training in a single topic, or you want to do a whole series on site, we can put a mini-conference together just for your team. For more information, Contact Me.
  • There are  - loading -  comments....

    (by Rock on 07/01/2006)
    Comment Loading


    Other Recent Stories...

    1. 09/02/2010Linux ext3 file system performance wierdnessI've had trouble off and on with a couple of Domino servers on linux. The server goes pear shaped and when I ssh in and look at the console, Domino is reporting drive errors. If you attempt to do anything on the OS at all, you quickly see that the whole file system has shifted into a "read-only" state. This is a bit like a car with a transmission problem shifting into "limp-home" mode. Needless to say, Domino doesn't like being unable to write to the disk. It has happened to me specifically with the most ...... 
    2. 08/31/2010A few tips for car sales people - if you ever want my business.I've been shopping for cars again. This one is a replacement for the spousemobile, so unlike the one for my daughter, this will be new. Having done a fair bit of shopping, here are some tips for you car sales people out there. #1. Do not bullshit me. I may know more than you think. It's just possible that I know how to build that car you're showing me. One lady insisted that I could ignore the EPA mileage sticker on a new Honda or Nissan (which happened to be what is on her lot) because (and I quote) ...... 
    3. 08/22/2010Creating a form generating tool that lets non-technical publshers create rich web formsI've been working on a tool for a client that wants to be able to create web forms to use on their site without learning any programming at all. At the same time, I don't trust any data from the browser side on a web site. I always assume that the browser side is open to hackers. That means any submitted form data has to be validated before it is accepted. Here's what I did... For publishing, I used the CKEditor, which is the web browser rich editor I've standardized on. For most web publishing uses, I use ...... 
    4. 08/13/2010That didn't take long. Oracle is suing Google over the use of Java. Is IBM next? 
    5. 07/20/2010IBM has invented the time machine - and not in a good way 
    6. 07/18/2010A lot of work, but something I've always wanted to do -- Fixing up a car for one of my kids 
    7. 07/13/2010Old Spice -- Their marketing team fully groks social media.  
    8. 06/22/2010Product Review: Plantronics Savi Office wireless headset 
    9. 06/16/2010Ed Brill has a blog. Peter O'Kelly has blog... 
    10. 06/15/2010How about Traveler for Desktop? 
    Click here for more articles.....


    pen icon Comment Entry
    Subject
    Your Name
    Homepage
    *Your Email
    * Your email address is required, but not displayed.
     
    Your thoughts....
     
    Remember Me  

    Please wait while your document is saved.