3. 引数のデータ型

In the function editor page of the BlackBox Builder, you have the ability to add parameters to your function. Each parameter can be given a data type.

Because of the many varied ways that users can pass data through to a function as a parameter, it is sometimes difficult to tell what the value of that parameter should be, and how we should treat it in our .rct scripts.

Take the following for example:

 

 

We are expecting a Date to be sent through as the second parameter. So the Web Viewer calculation looks something like this:

DemoControl( "Digital Fusion", GetAsDate( "24/08/2009" ) )

This is passing through an actual date object that we can use in our calculations. But take this for example...

DemoControl( "Digital Fusion", 733643 )

Some of you may have done the math - 733643 is FileMakers numeric representation of the date 24/08/2009. We COULD employ some rigourous javascript based data checking and validation in every one of our .rct files, or we could simply set the 'Data Type' field in the BlackBox Builder to 'Date'. This will make sure the value we get in our parsed file is an actual date. If the plugin can't get this value as a date, we will simply pass through the value as it is.

In your reactor calculation, you can then check to make sure you have valid data by using this:

<?reactor IsValid ( $YourDateGoesHere ; $YourDateGoesHere ) reactor?>

Reactor will still send your date through as a text string, so you can use it anywhere in your .rct file, but you can now be sure that if your date is in fact a date, and not a string.

Data Types Available

Data Type

Description

Text

Plain Text, stripped of any formatting. This is the default data type we use.

Number

Number value. This works the same as FileMakers 'GetAsNumber' function. If your parameter value is 'Value 12:34.56', the number passed through to Reactor would be 1234.56

Date

As described in the article above. Similar to FileMakers 'GetAsDate' function. If a text or number representation of the date is passed through, you will be returned a date string in your Files localisation format. The date format will always be 'YYYY-MM-DD'. You can use the FRTB.convertDateTime function to convert this to a JavaScript Date Object.

Time

Similar to FileMakers 'GetAsTime' function. If a text or number representation of the time is passed through, you will be returned a time string in your Files localisation format. The date format will always be 'HH:MM:SS'. You can use the FRTB.convertDateTime function to convert this to a JavaScript Date Object.

Timestamp

Similar to FileMakers 'GetAsTimestamp' function. If a text or number representation of the timestamp is passed through, you will be returned a timestamp string in your Files localisation format. The date format will always be 'YYYY-MM-DD HH:MM:SS'. You can use the FRTB.convertDateTime function to convert this to a JavaScript Date Object.

Styled Text

The Data Type 'Text' is stripped of all style formatting (Text Color, Bold, Font etc). Use this, if you want to have styled text passed through to Reactor. Similar to FileMakers 'GetAsCSS' function. The text will be passed through with span/style tags, so you can use the result of this directly in HTML code.

Container

This Data Type will give Reactor the passed container data, and will pass through a URL which you can use directly to display the contents of the container. Very useful for images/pdf documents or other web friendly content like flash/swf.