Sign In Register

How can we help you today?

Start a new topic
Solved

Large integers in gs-query-field

I've got some dates stored as Javascript timestamps, which are large integers, 1448930275000 for instance. I setup a gs-query with an integer field to query the timestamp column, but I get back a fatal error when I enter these large numbers:

org.mozilla.javascript.EvaluatorException: Access to Java class "java.lang.Class" is prohibited. (292243-forms-null#6)


I would prefer to query my timestamp columns using date selectors, but need them as integers for several reasons. I would really like to have some way to query the columns, and this bug prevents that. Thanks.


Hi Arnold,


Thanks for pointing this out to us, a member of the dev team is currently  investigating this for you. I'll let you know when there's an update.


Thanks,

Liam

Hi Arnold,

Can you send us the snippet of code you are using to build the query component?

Thanks,

James

 

Sure here's the whole form:

  

<gs-form snippet="quest_search_results" target="quest__results">
    <gs-query name="gsQuestQuery" >
    
    <gs-query-field id="_id" 
                    label="ID" 
                    type="oid"/>
    
    <gs-query-field id='XP'
                    label='XP reward' 
                    type='integer'
                    operators="equal,less_or_equal,greater_or_equal"/>
                    
    <gs-query-field id="names.EN" 
                    label="Name" 
                    type="string"
                    operators="begins_with,equal,not_begins_with,not_equal"/>
                    
    <gs-query-field id="startDate" 
                    label="Start Date" 
                    type="integer"
                    operators="less_or_equal,greater_or_equal"/>
                    
    <gs-query-field id="endDate" 
                    label="End Date" 
                    type="integer"
                    operators="less_or_equal,greater_or_equal"/>
    </gs-query>
    <gs-col width="12">
        <gs-submit>Submit</gs-submit>
    </gs-col>
</gs-form>

The two that act up are the start and end dates. 


 As I said, I'd love to be able to do something like:

 

<gs-query-field id="endDate" 
                    label="End Date" 
                    type="date"
                    format="integer"
                    operators="less_or_equal,greater_or_equal"/>
    </gs-query>

to cast a date into an integer, but that's a little specific to my use case. 

Hi Arnold,

I'm afraid you can't do that.  We don't parse dates in such a way.

As a suggestion, you could take the timestamp value and use it in a separate value, that is not really a date, just an integer.  You would need to extract that using Cloud Code and display it in your form using Handlebars.

For example:

 

 

 <gs-query-field id={{myDate}}
                    label='my date'
                    type='integer'
                    operators="between,less,less_or_equal,greater,greater_or_equal,exists,not_exists"/>
</gs-query>  

 

 


You could then use the operators to search for values greater, less than or equal to that integer value.  It's not strictly a date, just a collection of integer values that happened to be similar to JavaScript timestamps.

Using my snippet above, did not give me the error you were receiving.

I hope this helps.

Kind regards,

James

 

My apologies, 


I have reviewed my code again and discovered that the search result page had a bug in it that was triggering that error when trying to output some debugging text.


Again, sorry to have bothered you on this one.

Login to post a comment