get timestamp format?

Is there any way to have a method evaluate either an element or a dataprovider, and return the data type and/or format?

Perhaps this would work: I see .getType() under DatabaseManager, JSColumn, but this area is still pretty new to me. Could someone tell me how to get from an element or dataproviderID to a type?

Scenario:

I have a handy form showing tables in tab panels. Above the tabpanel, the user has three fields: field, operator and value. The user can select a field name (from a list), choose an operator (like starts with, ends with, >, etc.) and a value. The table will then be ‘filtered’ by a method that searches in the table form.

This works great for text and number fields, but timestamps are a bit trickier.

If I know that the field to be searched is a certain format, then I could append the format to the search (i.e. ‘|MM/dd/yyyy’). However, to this point, the entire thing is dynamic; the list of fields, f’rinstance, is picked up by a looping method. I want to avoid hard coding for particular fields in particular tables.

if you can search in that form then you have the controller.
The controller can be asked what the server and the table is.
Then you can ask the databasemanager for a jscolumn for the specific server/table/dataprovider and you have the type.

Well, I seem to be on the right track, although the syntax royally kicked my butt for a while. :wink:

So now I see that a text field results in a 12, and a datetime results in a 93. Is there a list of field type codes somewhere? I don’t see them in help, but that doesn’t mean they’re not there someplace. :roll:

If I can be sure that a datetime will always be 93, that could be enough. I could just format any datetimes on these table layouts the same way, and format the search accordingly whenever I have a ‘93’ field. However, I want to be sure this type code doesn’t change based on format, or database, or day of the week :shock:, or whatever.

you can test them with java.sql.Types.DATE or other like that:

see: http://java.sun.com/j2se/1.5.0/docs/api … Types.html for all the types that are available .

This is working, but…

How can I determine the table that an element is using? I can get the dataproviderID, which includes the relation, but I can’t seem to get to the table to find out the field type.

I just seem to be missing a link somewhere in the chain.

I think that you have to do that by hand currently.
So make a map: relation->table