Skip to main content
Participant
May 12, 2008
Question

CF and Flex Unexpected data type change

  • May 12, 2008
  • 1 reply
  • 658 views
My apologies in advance for a long post.

I have a Flex application that talks to either a SQL Server or Oracle database through ColdFusion. One screen has a datagrid which is bound to a query returned by a function contained in a cfc. A number of the columns are integers to be used as flags (0 or -1), and there are checkboxes on the screen bound to these columns. When I call the function with a connection to SQL Server, I receive the data in Flex with the data type I expect - string for descriptive fields, and int for the integers. When I call the same function with a connection to an Oracle database, all of the data is of type string. Yes, I have confirmed that the table is defined correctly in the Oracle database. Also, dumping the metadata of the query from CF shows that the numeric fields are numeric, and the string fields are string; however, examining the ResultEvent.result in the handler shows that all of the values have been sent back to Flex as strings (performing the same check in SQL Server reveals that the fields are of the expected data type). The end result is that the checkboxes always appear to be checked when connected to Oracle, but the checkboxes follow the data when connected to SQL Server.

Has anyone else seen anything like this? Am I missing something painfully obvious?

Thanks in advance,

Leighton
This topic has been closed for replies.

1 reply

Participant
May 15, 2008
Still don't know why it is doing what it's doing, but I have a workaround for anyone experiencing the same kind of thing.
I have changed the selected property of my check boxes to perform an explicit coercion of the type to Boolean as follows.

Before:
selected="{lstPermitType.selectedItem.AUTO_ISSUE_TEMP}"

After:
selected="{Boolean(int(lstPermitType.selectedItem.AUTO_ISSUE_TEMP))}"

This allows the check boxes to properly display the expected value based on the item selected in the list rather than always displaying a check (even when the value is "0").