One benefit of exposing the API I could see is to use JavaScript code to build a custom layout by setting the coordinates, height, width, font settings, and so on. That would be an interesting idea too.
That’s something I’ve been thinking about. This would be a way to visually show the progress of actions (quoted, P.O. received, parts ordered, in production, shipped, invoiced, paid) like changing the color of certain graphic elements, like big arrows, squares, rectangles, etc.
-
This reply was modified 2 years, 5 months ago by
Daniel Leu.
-
This reply was modified 2 years, 5 months ago by
Brendan.
-
This reply was modified 2 years, 5 months ago by
Brendan.
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks
One benefit of exposing the API I could see is to use JavaScript code to build a custom layout by setting the coordinates, height, width, font settings, and so on. That would be an interesting idea too.
Hi Brendan,
I have this problem generally. Delete and replace field in layout is without effect.
Maybe I make some stupid mistake. Simply script is here:
function Fill_Match() {
var ar_lv_r1_id = ‘fld-19384a3f4f1248ea82b16a9d4eee55e0’;
var ar_lv_r2_id = ‘fld-68464406010642928be2d4722d5b73fa’;
var ar_lv_r3_id = ‘fld-a09de8a68b6a4658bb030c677341a670’;
var ar_hv_r1_id = ‘fld-15db9eb1f8be4797a7f787ee90d40d04’;
var ar_hv_r2_id = ‘fld-47295e7cae1a46d6935848285ba24c82’;
var ar_hv_r3_id = ‘fld-37dc77cbaf2941a285c76be51f14fa03’;
record.setFieldValue(ar_lv_r2_id, ‘XXXX’);
record.saveAllChanges;
console.log(record.getFieldValue(ar_lv_r2_id));
return;
}
Fill_Match();
Also, you can have a Script Field just return its data and display it on a custom layout. You don’t have to set another field with the result just to display the result.
Text can be placed on a Form as part of the layout using the “A” icon labeled: “Add text to your layout”. Is there a way to get an object id of that text object. This would be to change the text via scripting as you do with regular form objects. Thank you.
-
This topic was modified 2 years, 5 months ago by
alang.
You don’t need a separate field to contain the results of the Script field execution. You can just display the Script field directly because whatever you return from the Script will be displayed by that field. If the relationship field is the inverse of a One to Many (that is, a Link From Form field), then the Calculation field formula can also return that value and takes just a single double-click on the Formula Edit screen for the Calculation field.
I see. Thank you. On the form I am linking to are several fields that are themselves, “Link To Form”. So they, of course, are not available to display in the popover (or the left of the child form itself). I do need some combinations to appear in the popover. For example, the child form used to populate the popover, called Sources includes books titles. A field on Sources is Authors, which itself, is a “Link To Form” (to Authors) since a book might have several authors. What I want to appear in the popover populated by Sources would be, for example, a principle author (identified somehow in the authors form) plus the book title. So given what you have said, I am thinking that I need to utilize either a calculation field or a script field to extract on the sources form, for each record, book title plus author. The scripting would need to select which author. I would take that title plus author and place it in a regular text field on the form, Sources (the child form that will populate the popover). This plain text field, populated by the script with author-title, would then appear as a field to select for the popover. If I managed to make that clear, does it sound like I am headed down a reasonable path? Or does a better approach come to mind? Thank you.
Got it, with an experimental field.
Now, what happens if I change an Numeric field to an incremental stepper field? Do I lose the data or does the data remain and I can increment it?
BTW, I read the increment field information before I asked the question and what you said is clear, but in the manual on line it was very confusing and I thought it said the field would increment anytime the record was opened (my memory) so that is why I asked about scripting.
I have a field that holds a numeric value. I have to select that field, delete the number that is there and replace it with a number + 1.
Is there a way to increment a numeric value without going to all that work with a script?
Hi Tim,
The tricky part is getting the list of records for just the month and then total that up. You could do it, but it would require writing some JavaScript in a Script field to get the list of records, loop through them to find which records match the month you’re interested in seeing and then totalling up the value from your amount field, then returning that value so it displays in the script field on your record.
There is a simple function called form.getTotalOfField(fieldID); to get the total of a field from a form, but the tricky part in your case is to get the total just for a specific range of records.
How’s your scripting ability?
Thanks,
Brendan
In the script editor, clicking on the symbol to the right of fx (highlighted in the attached image) opens the Select a Field prompter. There I select field_id followed by the field of interest. This creates the typical field definition in the code:
var field_name_id = 'fld-xxx';
Attachments:
You must be
logged in to view attached files.
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks
The really great script editor on the desktop version makes it easy to get and use a field_id by clicking in a list. Is there an easy way on mobile to get a particular field_id? Or, do you manually need to do that in code, using perhaps, getFieldIds()? Thank you.
-
This topic was modified 2 years, 5 months ago by
alang.
Ah! Just starting to learn scripting. So that’s very helpful. Thank you again!
-
This reply was modified 2 years, 6 months ago by
alang.
-
This reply was modified 2 years, 6 months ago by
alang.
I forgot to mention, the Child Records Loop snippet on the Script Edit window will write most of the code for you. Just add a Script field to your parent form, then open the Script edit window. Then select a field from the Link to Form field on the list of fields on the left of the Script Edit window. Then double-click on the Child Records Loop snippet. Tap Forms will write the code you need to loop through all the child records. Then just join the value from the field into an array using the push() function and then join them together as a string using the join(", ") function.
Hi Tom,
You can do this with the DATEADD() function and the IFEQUAL() function.
For example:
DATEADD(Date;0;IFEQUAL(Service Interval; "Filter"; 14; IFEQUAL(Service Interval; "Tubing"; 90; 0)) ;0;2;0;0;0)
the IFEQUAL() function takes 4 parameters. A field, a value to compare the field with, a return value if the field equals the value, otherwise another value if they’re not equal.
It does get a little complex when you’re embedding functions within other functions. It’ easier to understand scripting code though, so you could also do this using JavaScript.
Hope that helps!