Using the WorkXpress API: Display Formats

12 Dec 2009 | API, PHP, SOAP, Web Services, WorkXpress

WorkXpress You have learned about all of the functions. You understand the data formats. What could possibly be left before mastering the WorkXpress API? Display formats is the answer.

Display formats allow you to pull out data in different formats. For example, instead of pulling a file field as XML (stored value) or just the filename (text value), you could get the download URL. When using display formats, the format type must be set to “text”. Not all Fields have display formats, while others have several. Many of the available formats match the available parts for multi-part fields. For more information on these parts, see my previous post on data formats.

Address

The Address Field Type exposes a number of display formats to match the available parts of the field.

These formats can be combined to create you own format. For example, let’s say you want to display only the city, state and zip code of the address. Your format string would look as follows:

$format = 'City, State ZipCode';

You can even add your own text to the string, just make sure not to use any of the format parts in your custom text (display formats are case sensitive).

$format = 'You live in City, State Country';

// Since display formats are case sensitive, you could also do something like
// the following.
$format = 'This client hails from the city of City';

Currency

Currency Fields usually return the currency symbol ($) when using the text only version. Using the NumberOnly format allows you to pull the value without the currency symbol (ie. “3.12” instead of “$3.12”). You can get the same result from using the stored format type instead of text.

Phone Number

Phone Number Fields are similar to Address Fields. The display formats for Phone Number Fields match the available parts.

Select - Select One

Select - Select One Fields provide display formats that allow access to some of their special features. No display format will return the title of the currently selected Select Option.

Check Box

Check Box Fields provide a few different formats to handle their unique on/off nature. Most of your requirements for this Field Type can be handled using the stored format type.

Date and Date Time

Date and Date Time Fields provide display formats that can be useful for displaying their values in different formats. Many of these formats correspond to the formats provided by PHP’s date function.

File

File Fields can be difficult to deal with. Display formats are here to help. Using the display formats below, File Fields can be much easier to deal with.

Social Security

Social Security Fields provide only a single display format part. By using the LastFour format, you can retrieve only the last four digits of a social security number. With no display format, this Field Type will return the value as “***-**-####”.

Now You’re Ready!

That’s all folks. You have everything you need to master the WorkXpress API. The API opens up a lot of possibilities for you and your application. Current uses of the API include integrating with FedEx shipping services, data imports with HarrisData and administration of FTP servers. Once you have had a chance to explore the power of the API, come back here and let me know how you used it. As always, if you have any questions, leave a comment below.

comments powered by Disqus

Older · View Archive (34)

External Links and GeSHi Filter

On my site I use the External links to add the external link icon image next to any external links. I also use the GeSHi Filter module for syntax highlighting. These two modules together were causing some undesirable effects.

Newer

Simple Tips For Repsonding To A Web Developer Job Posting

Outlook

I was recently tasked with hiring a web developer for a redesign of http://www.workxpress.com. I was surprised at the number of poor quality responses I received. The original post can be found at http://drupal.org/node/602292. Looking back, I should have included more details in my post, but that still doesn’t excuse the poor quality of some of these emails.