Friday, January 12, 2007

Sametime bot finds zip code with @DBLookup

Based on Thomas Adrian's Swedish postcodes database, I've created a function for our company's Sametime bot which returns the post codes(zip codes) for a specified city or the city name by specified zip code. All you need to implement this functionality in the free evaluation version of Botstatiuon Bot is to create a "pattern answer" with @formula which makes lookup to the database. Similar formula can be used for any database lookup from bot. Later I will add bot function to lookup for phone area codes for cities in USA and Sweden.
With Sametime Widget (STWidget) AJAX-based tool you can make a live test of the function.
Commands you can type to bot:
postcode 18200
postcode Danderyd
zip 14700
zip tumba

And of course the most popular "joke" command which shows you a random joke every time you type it :)

TRY HERE: http://www.botstation.com/products/stweb/stwidget_zip.html


-------------------------------------
city:=@ReplaceSubstring(@Trim(@Right(@RequestText;" "));" ";"-");

tmp:=@DbLookup("":"NoCache";@Subset(@DBName;1):"bot\\pnr.nsf"; "By city";city;2);
@If(@IsError(tmp); @If(@Length(city)!=5;@Return("Postnumber not found for city "+city);"");@Return("Zip code(s) for "+city+": "+@Implode(@Sort(@Unique(tmp));", ")+"<br>--------------<br>You can also try reversed command:
postnumber "+@Subset(tmp;1)));

tmp1:=@DbLookup("":"NoCache";@Subset(@DBName;1):"bot\\pnr.nsf"; "By number";city;2);
@If(@IsError(tmp1);"City for postnumber "+city+" not found"; "City for postcode "+city+": "+@Implode(tmp1;", ")+"<br>--------------<br>You can also try reversed command:<br>postnumber "+@Subset(tmp1;1))

-------------------------------------

@RequestText function above is translated by Bot into the incoming command text, for example "zip 12345".

Screenshot of Bot's answer configuration page:
Sametime bot formula

An alternative way to find zip code is to make call to a Web Service, which is also possible with Botstation Sametime Bot, I'll show how to accomplish it in some of the posts later this month.


Related posts:
Sametime bot shows a random Bible quote
Merry Christmas from Sametime Bot




Tags:

3 comments:

Anonymous said...

By the way, I recommend you buy the cheapest Atlantica online Gold and Atlantica power leveling from us where the prices here are low. So if you have the Atlantica Gold is useful to your level spear. Once you meet a real smart player with 2 spearmen team, their key to disable builds, and then you should buy Atlantica online Gold. In addition if you need to buy goods for your characters, the game provides you the cheap Atlantica online Gold. And the last, you can make the fun of the Atlantica online money in the Atlantica online world.
You need lots of kamas to enhance your game character. Follow the guide below, you will have a better experience in dofus kamas. Because of Bambooto attack with both earth and wind damage, with also heals kamas. There are some cheap kamas in the Dofus and that is very useful. The best part is that bulbiflor can drop bulbiflor magic bark, which sells for 50000 dofus gold and requires just 100 prospecting to get leveling my feca there got one between lv24 and lv46. They sell well kamas anytime too, so you can buy dofus kamas at anytime.

cheap silkroad gold said...

Now do you worried about that in the game do not had enough shaiya gold to play the game, now you can not worried, my friend told me a website, in here you can buy a lot shaiya money and only spend a little money, do not hesitate, it was really, in here we had much cheap shaiya gold, we can sure that you will get the shaiya online gold, quick to come here to buy shaiya gold .


Now do you worried about that in the game do not had enough silkroad gold to play the game, now you can not worried, my friend told me a website, in here you can buy a lot sro gold and only spend a little money, do not hesitate, it was really, in here we had much silkroad online gold, we can sure that you will get the silk road gold, quick to come here to buy cheap silkroad gold.

Adi said...

Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa page and other update like as Beratnya Mengembalikan Jati Diri Bangsa, Mengembalikan Jati Diri Bangsa di perpanjang and Jangan Berhenti Mengembalikan Jati Diri Bangsa. Thank you So much.

Oes Tsetnoc | Lanjutkan Mengembalikan Jati Diri Bangsa