Skip to content

Handle booleans between FileMaker and AS3

01-Nov-10

THis is the best way you can easily handle boolean type conversion between FileMaker and ActionScript, specially when using AMF services.
As you know, FileMaker doesn't have Boolean field type, but can use, evaluate and return boolean values as a result of the evaluation of Text or Number fields. In addition, FileMaker versions before 6.x, version pre-7.0, and versions 7.0, 8.x, 9, 10 to 11, have significant differences in boolean evaluation:

You can use any of these values to be evaluated as TRUE: [non blank field], 1 or "1"
You can use any of these values to be evaluated as FALSE: [blank field], 0 or "0"

In FM v 6.0 and earlier, you can use these strings as well:

Evaluates to TRUE: "True", "Yes", "Y", "y", "T" or "t"
Evaluates to FALSE: "False", "No", "N", "n", "F" or "f"

Obviously my recommendation is to use a Number Field, set to 1 or 0 (and forget FM version 6 and earlier).

In the remote service, define the corresponding class (for to your Value Object) to threat it as int...

(in php will look like this...)

 filemaker |  copy code |? 
01
<?php
02
class LabelVO {
03
 
04
	public function __construct() { }
05
 
06
	var $recid;
07
	public $isValid;
08
	public $sku;
09
	public $txt;
10
	public $_explicitType =  "com.myPackage.LabelVO";
11
 
12
	public function __set_state ( $assoc ) {
13
		$this->recid	= (int) $assoc->recid;
14
		$this->isValid	= (int) $assoc->isValid;
15
		$this->sku	= (string) $assoc->sku;
16
		$this->txt	= (string) $assoc->txt;
17
	}
18
}
19
?>

Then in the AS3 side, build your value object in this simple way...

 ActionScript |  copy code |? 
01
package com.myPackage
02
{
03
 
04
	[RemoteClass(alias="com.myPackage.LabelVO")]
05
	public class LabelVO
06
	{
07
		public var note : String;
08
		public var txt : String;
09
		public var sku : String;
10
 
11
		[Transient]
12
		public var valid : Boolean;
13
 
14
		public function set isValid (value : int) : void
15
		{
16
			valid = value > 0;
17
		}
18
 
19
		public function get isValid () : int
20
		{
21
			return valid ? 1 : 0;
22
		}
23
 
24
		public function LabelVO ()
25
		{
26
		}
27
	}
28
}

Cairngorm template with ScriptMaker (I)

09-Feb-10

There is a simple FileMaker script that builds up a basic Cairngorm package filesystem in your disk. This versión uses shell commands, compiled inside AppleScript executed from ScriptMaker scripts... so Mac OSX only, but a cross platform with any FM plugin can be easily reworked from here.

More…

Review of a great work

07-Feb-10

Real time tracking for near 140 Catalan (Catalonia, Spain) players participating on the Olympic and Paralympic Beijing 2008 summer Games.
This web application tracks the schedule, real time news and events during the Olympic and Paralympic Beijing Games. Until the competition begins you can see who will be on the lane, their best recent results and a personal video presentation explaining what they are expecting and how are preparing for the event.
During the competition players , coachs and journalists involved in the project will feed the system with news, live results, scores and personal impressions.

olimpics.cat detail

Amazing example of integration betwen FileMaker and Flex. To be honest it is much more visual than data intensive, but was much more popular that other works I've ever done... maybe the keyword "olimpic" did the magic :-)

Find it at OLIMPICS.CAT !

Some mentions you can check: Flex Ria, and the "Site of the week" on This Week in Flex - Episode 1

Of course, you can try it in your iPhone browser !

Cheers

FileMaker XSLT Basic Lib. Exporting data

07-Feb-10

The basic xml/xslt operation: export FileMaker records to XML trough XSLT transformation. This is a fast, easy and powerfull way to build any type of text file you need, from basic tabed or csv text delimited files to PDF, Excel, HTML,... or wathever you want.

Find here two basic examples on how to convert FMPXMLRESULT grammar (remember that FIleMaker uses FMPXMLRESULT in direct export, not the XMLRESULTSET used in reply to http queries).
More…

New Flex & FileMaker app released

06-Feb-10

Newtwork BCN Software has released a new web application built with Flex & FileMaker. The server side is a simple but efficient AMFphp service connected to FileMaker trough CWP interface, getting and pushing data over XMLRESULTSET native xml (no xslt transformation on the road).

We wrote a brand new generic FileMaker Library por AMFphp that we'll publish here in next posts. It's extremelly fast and reliable, supporting pagination and delivering native objects to client side ActionScript.

THe new app, HancpTool, is a new self-evaluation tool including obesity-related nutritional criteria such as: total amount of fat, saturated fats, trans-unsaturated fatty acids, salt and sugar concentration. It brigns facilities to people to reformulate and re-analyze their recipes in order to keep it healty.

You can try and play with this app here: The Food Pro-fit Project's HancpTool, use the demo account (recomended) or create a new one (free).

Note: the Foodprofit European Project wishes to improve the nutritional quality of prepared or processed food at all levels in order to make the healthier choice for the consumers.

HancpTool overview

[Clic to view full image]

Read UTF16 XML FileMaker files with Air

06-Feb-10

As you know FileMaker generates Unicode XML output (export or trough xml web interface). Unicode text streams could be UTF16 or UTF32 and the two can use certain order in the multibyte representation ot each character: this is the Big Endian and Little Endian order options.
UTF16/32 text files uses sometimes a signature called BOM (Byte Order Marker) that represents which of the several Unicode representations the text is encoded in. A simple (very simple) table of this BOM options can be:

00 00 FE FF = UTF-32BE, big-endian
FF FE 00 00 = UTF-32LE, little-endian
FE FF = UTF-16BE, big-endian
FF FE = UTF-16LE, little-endian
EF BB BF = UTF-8
More…

Parsing XMLRESULTSET metadata (in PHP)

04-Jun-09

This very simple php function parses the xml metadata from xmlresultset to a php associative array, with name-value pairs. Useful if you decide to drive the fast path to FileMaker data over HTTP and seems the fastest way I've found to date.
We'll use this parser in next posts when describing how to implement AFM3 FileMaker Services on AMFPHP.
More…

Handling FileMaker date, time and timestamp types (II)

04-Jun-09

[This post does not replace the previous related one]

There is a new date-time parser useful when you are dealing with dates to and from FileMaker (FMDate, FMTime, FMTimeStamp) and ActionScript (allways Date). If you like static classes, that may be better for the case, then declare it as public static class DateTimeParser, then simply import the package and call methods as static functions. Instead use as is, instantiating the class and calling the instance methods.

Remember that you should send/receive STRINGS to/from FileMaker WPE, not ActionScript Date objects, then you should convert the FileMaker date-like formated strings to ActionScript Date objects. In ActionScript Date, Time and Timestamp are describet using the same class object, the Date() class object, so all Date, Time and Timestamp FileMaker strings should be converted to AS3 Date objects, and to corresponding strings before sent back to FM.

More…

Using the POST method with HTTPService

26-Sep-08

Despite this is not a Flex/FileMaker specific thing, I would like to comment a very important aspect on using the HTTPService in the RPC you'll set to move data to and from FileMaker using the HTTP chanel.

The HTTPService can send the complete request using POST or GET methods (well, also the PUT, DELETE and other methods are allowed, for REST services i.e.), and we recomends you to set it to POST for diferent reasons.

  • Hidding the request params from the user view
  • Overriding the request size limit (usually 8K in default Apache install)

These are two gret reasons, but there is a common error that forces HTTPService to pass all the request params in the headers of the http request instead of the body, that's what they should do when set to POST instead of GET:

More…

Populate a Flex Combobox with FileMaker valuelist data (II)

21-Sep-08

In the first part of this tutorial, we ended with a XML data stream that we can get by a simple http call, so we go ahead starting our minimal Flex app that can handle this call, eat the xml reply and put his data on a combobox component.

We are at the beginning of this blog and I'm trying to be very clear and symple in order to introduce FileMaker developres to Flex, so the explanation will look extremely simple for many Flex coders. Sorry, but next post will assume we are talking to skilled Flex coders. As a one time comment, there are some details about the sampler database...

This is our test unit database, some particular field types were used to introspect into datatypes later in the blog (we'll reuse the samples, just save time recycling code).
More…


Warning: require_once(Zend/Http/Client.php) [function.require-once]: failed to open stream: No such file or directory in /private/etc/php/zend/Oauth.php on line 23