Forum Discussion
BobJordan
9 years agoQrew Cadet
Hey Dan,
You mentioned that this could be done with script and regular expressions - can this be done within a quickbase formula field?
I've noticed that within a text formula field I can include "javascript($string..." and it will accept it, but any parameters of the javascript variable willl error out (ex: javascript($string.search("S5")) will result in an error at the .search part).
You simply cannot get the anywhere near the level of precision with the extremely limited set of text manipulation functions in QuickBase compared to using script and regular expressions
You mentioned that this could be done with script and regular expressions - can this be done within a quickbase formula field?
I've noticed that within a text formula field I can include "javascript($string..." and it will accept it, but any parameters of the javascript variable willl error out (ex: javascript($string.search("S5")) will result in an error at the .search part).
- _anomDiebolt_9 years agoQrew EliteIt isn't worth the trouble trying to put JavaScript into your formulas as you will have a difficult time debugging your formulas and adding a lot of character escaping which makes the formulas unreadable. It is best to get out of the formula language as quickly as possible and pass the least amount of field values to the script. When you try to do parsing like this exclusively in the formula language you have to limit yourself to some upper bound of instances you can parse because the formula language has no looping or iterative methods and this process makes for jumbo formulas. In script you have no such limitations or nuisances.
Anyways I have a demo in preparation for a similar question which I should finish shortly. I will reread your question and reply further when I get a chance. - BobJordan9 years agoQrew CadetHi,
Thanks Dan. Understood about the script in formulas - it does seem rather cumbersome. If I wanted to look into getting out of formulas though, where woudl you input the script?
I work with imported sheets, so I'm attempting to pull the middle strings out from these imported fields. Is there a specific type of field and format I should use to make use of script? - _anomDiebolt_9 years agoQrew Elite>where woudl you input the script?
Read these:
How Do I Setup the Image Onload Technique (IOL)?
https://community.quickbase.com/quickbase/topics/how-do-i-setup-the-image-onload-technique-iol
Pastie Database Record #294
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=294
What is the Simplest IOL Example?
https://community.quickbase.com/quickbase/topics/what-is-the-simplest-iol-example - BobJordan9 years agoQrew CadetThanks Dan - very helpful. I now have the IOL working with the alert popping up on my forms.
It looks like in order to make the .js target a specific field, I'd need to specify the field ID I'm trying to target, correct? I'm going off the example you provided here: https://community.quickbase.com/quickbase/topics/what-is-the-simplest-iol-example
So to get the middle string using this method, I'd do something like:
$("#_fid_[field ID of field]").substring(1,4);
This code by itself doesn't seem to work though.
I assume that I would need a separate module.js page and new IOL field for each custom js I'd like to include in the form, correct? For example, having one formula that finds a middle string and another that throws an alert would require two .js pages and two IOL fields on the form.- AdamKrzyzanek5 years agoQrew CaptainI know it is old Post but Was looking for this solution and did not find in Community.
Come up with such solutions posted HERE
------------------------------
Adam Krzyzanek
------------------------------- MarkShnier__You5 years ago
Qrew Legend
Yes, once we got that new function for SeachAndReplace it was very useful for parsing. This thread was from before that gift of a new function in about March of early 2019.
------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.com
mark.shnier@gmail.com
------------------------------