Error Formula too long

Posted by Rollbase User on 12-Sep-2012 15:49

I have a formula (string) field to validate that a text field is not null. The text field is very large. Though my formula is very simple, because of the data in the fields, I am getting this error: Error Formula too long: 11529 chars, 10240 allowed in formula: I know we have encountered this before when the actual formula itself was too long but in my case, it's the data I am validating against. Here is my formula: '{!research_proposal}' != ""; Are there any work-arounds for this?

All Replies

Posted by Admin on 13-Sep-2012 00:10

Size refers to parsed formula, not to original formula. Perhaps your research_proposal field is too long.

Posted by Admin on 13-Sep-2012 12:40

Hi Parker,



Pavel just reminded me that there is a property called MaxFormulaSize in shared.properties. You probably want to increase this to 20480 or something high enough to allow your parsed formulas to run.



Note that they bigger the formula the longer they take to parse and execute. With many formulas this can have a compound affect on performance, so use this with caution.



Thanks,

Matt

Posted by Admin on 04-Oct-2012 13:58

Matt,



Where can I find shared.properties?



Parker

Posted by Admin on 04-Oct-2012 15:45

Is there anyway to acces the text field character count function in a formula?



Then I could just validate that the field.character.count > 0 instead of the whole text field being not null. Each of these fields could have 250-1000 words in them, depending on the field. We are not using your built-in limits.



'{!needs_addressed}' != '' &&

'{!reason_funds_needed}' != '' &&

'{!additional_resources}' != '' &&

'{!fundraising}' != '' &&

'{!collaborators}' != '' &&

'{!duplication}' != '' &&

'{!grant_service_area}' != '';

Posted by Admin on 04-Oct-2012 15:52

I'll add API for that.

Posted by Admin on 04-Oct-2012 16:00

Hi Parker,



shared.properties is a file in your rollbase installation's "shared" folder. My guess is Joe R will know about this file in your installation.



Hope this helps,

Matt

Posted by Admin on 04-Oct-2012 16:04

Hi Parker,



All formulas allow you to use the full power of JavaScript (I think you already know this but I'm stating it here just in case, sorry if this RB101 to you). So to check the length of any text-based field I would do something like:





var myfield = "{!myfield}";

// check length of myfield by using myfield.length

// for example

if (myfield.length > 0) { // etc





Hope this helps,

Matt

Posted by Admin on 04-Oct-2012 20:25

Thanks Matt and Pavel,



I tried that but unfortunately it still pulled in the full content of the text field into the parsed formula to get the length. I ended up getting help from Joe and using this:



var field_length = rbv_api.selectNumber("SELECT LENGTH(some_field) FROM some_object where the_id_field = ?", the_current_record_id);

Posted by Admin on 04-Oct-2012 21:30

Excellent! Sorry I misunderstood the issue. Great solution

This thread is closed