Search Results for 'script'
-
Search Results
-
Hi !
I’ve a movie database in which there’s a Tag pick list, made of checkboxes. I want to find how many different records have a certain item in this pick list checked.
So thinking the pick list returned something I wasn’t sure of, I tried to get the type of the object, but all I am getting is undefined.
var value = movie_form_records[index].getFieldValue(movie_form_tags_id);
console.log(typeof value);
(console output is “undefined”)So when I try this :
var pos = value.search(“Feel good”);It never returns any item, despite the fact that some of the records have this tag. I know this because using the search filter, I can find several movies for which this tag is checked.
My loop goes through all the records and make the following test :
if (pos >-1) {
nombre++;
}But when I am running the code, I am getting the following output in the console :
2021-03-10, 8:17:57 AM / Movies / Feel good
Feel good: TypeError: undefined is not an object (evaluating ‘value.search’), line:(null)
Feel good: TypeError: undefined is not an object (evaluating ‘value.search’), line:(null)The whole code is :
function Feel_Good() {
var nombre = 0;
var movie_form = document.getFormNamed(‘Movies’);var movie_form_tags_field = movie_form.getFieldNamed(‘Tags’);
var movie_form_tags_id = movie_form_tags_field.getId();var movie_form_records = movie_form.getRecords();
for (var index = 0, count = movie_form_records.length; index < count; index++) {
var value = movie_form_records[index].getFieldValue(movie_form_tags_id);
var pos = value.search(“Feel good”);
if (pos >-1) {
nombre++;
}}
return nombre;
}So.. what am I doing wrong ? I’m a total newbie at JavaScript. So maybe I missed something somewhere.
Thanks,
Ray
So what I’m looking to do is re-build an old formulation database i built years ago in Access – where i’d have a large ingredient table with hundreds of ingredients (sugar, fats, etc – and each one of those had all their nutritional attributes stored in that same record).
There was a second table then, which had a number of drop down fields that linked back to the ingredient table – allowing me to select each individual ingredient for use in the formulation. I’ve been able to get this far in TapForms on my own.
Where I’m stuck is here: When i pull – say – sugar – from the drop down list that’s linked back to the ingredient table – what i’d also like it to do is pull and display the information for, say, carbohydrates – that is associated with the sugar i just choose. Why? Because I will then use that in a series of calculated fields to determine the quantity of carbohydrates in the precise formulation i’m working on, and get real time updates. This is what’s got me stuck. I’m not a scripter – so that’s out of my depth. Anything obvious I’m missing to help me do this?
Thanks folks
SJHi Folks!
QUESTION:
How can I force the location field to look automatically for the geocoordinates without opening it manually?
CASE
We need a to have an overview of our clients on map view. But it would be to much work to fill the location field manually. So, I have a little script, that fills the location field based on the data in the adress fields.
function FILLING_locationfield() { var ADR_street = record.getFieldValue('fld-a2…'); var ADR_postalcode = record.getFieldValue('fld-b7…'); var ADR_city = record.getFieldValue('fld-e6…'); var ADR_country = record.getFieldValue('fld-b9…'); var TARGETFIELD_locationfield_id = 'fld-01…'; var ADDRESSDATA_for_locationfield = ADR_street + ", " + ADR_postalcode + " " + ADR_city + ", " + ADR_country ; record.setFieldValue(TARGETFIELD_locationfield_id, ADDRESSDATA_for_locationfield); } function FILLING_locationfield();The problem is: This is filling the location field properly with the adress data. But in order that the location field is getting the fitting geocoordinates, I have to click on each adressfield manually and then to click on the save button.
So: How can I force the location field to look automatically for the geocoordinates without opening it manually?
Thanks in advance for any help.
Stay healthy, EDDY
I have a text field. It contains names (usually two or three words).
Is it possible to extract only the first word in a script field in way using regular expressions? (eg ^(\S+) (.*)$ or ^(.+?) (.*)$).