Forum Discussion
- _anomDiebolt_Qrew EliteYou can't do this with QuickBase formulas because there is no looping or counting construct.
It is simple to do with script. If your multiline text field was fid=6 and the numeric counting field was fid=7 you could use this code with the image onload technique to do the job:
$("#_fid_6").on("change",function(){ $("#_fid_7").val($(this).val().split("\n").length)}); - ElizabethElizabQrew MemberGreat, thanks for the quick answer! I will try that and let you know how it works.
- KenFirchKenFircQrew TraineeOr if you have a practical limit on the number of reports they enter, you could try something like this which works for up to 10 lines (and could be expanded to more):
var Number linei = ToNumber(Trim(Part([Reports], 1,"\n"))<>"");
var Number lineii = ToNumber(Trim(Part([Reports], 2,"\n"))<>"");
var Number lineiii = ToNumber(Trim(Part([Reports], 3,"\n"))<>"");
var Number lineiv = ToNumber(Trim(Part([Reports], 4,"\n"))<>"");
var Number linev = ToNumber(Trim(Part([Reports], 5,"\n"))<>"");
var Number linevi = ToNumber(Trim(Part([Reports], 6,"\n"))<>"");
var Number linevii = ToNumber(Trim(Part([Reports], 7,"\n"))<>"");
var Number lineviii = ToNumber(Trim(Part([Reports], 8,"\n"))<>"");
var Number lineix = ToNumber(Trim(Part([Reports], 9,"\n"))<>"");
var Number linex = ToNumber(Trim(Part([Reports],10,"\n"))<>"");
$linei + $lineii + $lineiii + $lineiv + $linev + $linevi + $linevii + $lineviii + $lineix + $linex
- BasuBQrew MemberHas there been any update that will allow the count of multiple lines in a field.
- _anomDiebolt_Qrew EliteTry this text formula field with some HTML allowed:
"<img src onerror='this.outerHTML='" & [Words] & "'.split(/\\s+/).length'>"
See:
Old Techniques Not Discolsed ~ List All
https://haversineconsulting.quickbase.com/db/bm5f3b6ra?a=q&qid=1
I Just Got Reamed Out By The QuickBase Coordinating Council!!!!
https://community.quickbase.com/quickbase/topics/i-just-got-reamed-out-by-the-quickbase-coordinating... - QuickBaseCoachDQrew CaptainDan, so that was impressive to a native guy like me.
Is that new that you can use non native syntax in a formula box with no IOL required? - _anomDiebolt_Qrew EliteThere is no IOL or code page needed for these types of formula.
But you realize of course that I am using my highly developed sense of humor to push for wider JavaScript adoption and eventual replacement of the formula language with JavaScript.
The mystery to me is why a native guy like you would be impressed with these new formulas because they are pretty odd to me and every other JavaScript developer.