Using data within a mixed attribute type to query Craft entries dates I wish to have a custom fieldtype which contains the standard datetime field abilities along with storing an extra piece of data. I have created a custom fieldtype for this with a mixed attributetype to store the data as JSON.

However I am having problems when I try to query some of the data from the frontend.

For example to pull out a specific piece of data I am currently doing:

variableName.date


This correctly pulls out the date I have stored. However when using this in the example:

craft.entries({ type: 'sectionName', customFieldtype.date: '&gt;=' ~ now|date(c) }).order('customFieldtype.date asc').first()


I get errors as when Craft converts this to SQL it's converting these to column names and customFieldtype.date doesn't exist.

Is there any way around this bar having to re-create the built in craft entries calls in pure SQL?
Just in case anyone else comes across this problem in the future I actually managed to figure it out myself.

I created kept the fieldtype as a DateTime field and grabbed the date/time and the extra value within the prepValueFromPost function then pushed the extra data into a custom table and post just the datetime to the craft_contents table.

Then within the getInputHtml function I grabbed the extra data from the custom table to display along with the date/time.