Tap Forms app icon half
Tap Forms Forum text image
Blue gradient background

Exchange tips and ideas with the Tap Forms community

Search Results for 'script'

Viewing 15 results - 451 through 465 (of 2,951 total)
  • Author
    Search Results
  • #49901

    In reply to: Custom join condition

    Mary Stamper
    Participant

    Thanks. I’ll think about this one. Just started using scripting. I’ll try to figure it out.

    #49899
    Mary Stamper
    Participant

    ha ha, not surprising. I tend to think more generally…..I have a data base of vocabulary words. Just 1 table. I choose a general part of speech (verb, noun, adjective, etc) and then one or more subtypes which are dependent upon the part of speech. For a verb, that could be transitive, intransitive, reflexive and a few more. So it is a dependent picklist. Not sure if scripting could be used to populate the dependent picklist based upon the value in the part-of-speech field. I’m relatively new to Tapforms, and I must say that I’m impressed with what you’ve accomplished. I’m not new to databases however, been doing Oracle for 30 years on my jobs.

    • This reply was modified 2 years, 1 month ago by Mary Stamper.
    #49897
    Brian Lennon
    Participant

    Many thanks Brendan – I will try your solution.  It will take me some time to absorb Javascript’s way of working!

    #49895

    In reply to: Custom join condition

    Brendan
    Keymaster

    Join type relationships can only do a direct equals comparison and not a contains type comparison. But you can use a Script or Calculation field to return some value in both form F1 and F2 that would do the special function to get an appropriate value (such as matched) and then use the Join from and to fields to join with those fields in each form.

    #49894
    Brendan
    Keymaster

    Also, hope you don’t mind, but I moved this thread to the Using Tap Forms forum instead of the Script Talk forum where you posted it. It’s not about the scripting feature.

    #49886
    Glen Forister
    Participant

    I’ve been looking for a Script like this that doesn’t need modification to work in any database and copy records from one to another.  I hope any bugs that exist get worked out.  I’m not a scripter so wouldn’t be able to modify it to work in my environment.

    Thanks guys.

    #49885

    In reply to: Convert 2 fields

    Glen Forister
    Participant

    Yes, I would like to do that.  I’m wondering though why create a new field to house the script instead of putting the script in the list of Scripts in the Scripts Tab.  Just a curious question.

    But, the Sctipt would be completely different that the above, so can you give me what I need.  Sorry I can’t do it and with the above, I’ve proven that the ChatGPT version isn’t great if you don’t already know Scripting and can debug it.

    Thanks.

     

    #49880

    In reply to: Convert 2 fields

    Brendan
    Keymaster

    Well, instead of the Script field actually returning a value, you can just have it set the value on the field, depending on what field you entered data into. The script will execute when you change a value in a field that’s reference in the getFieldValue() function. You can even hide the Script field from your form and it will still execute when the fields you reference are updated.

    #49878

    In reply to: Convert 2 fields

    Glen Forister
    Participant

    OK, that does make it work.  I see now that those were parameters, so a comma was needed.

    Thanks.

    I assume though, that making it work both ways, with some records getting the value of ft to be converted to meters, and other records being given the Meters to be converted to Ft. would not work because apparently one has to be a number field and the other has to be a Script field.

    Is that correct?  It would be nice if the calc went both ways because I sometimes know one value and other times I know the other.

    #49861
    Brian Lennon
    Participant

    I fixed the ID to Id thingy and the script seems to run start to finish producing URLs (that I don’t understand yet).  BUT, there is no copying of records from the source form to the target form.  Is there something I’m missing?

    My target form is a duplicate of the source form.

    (Very much a beginner with Javascript but making progress thanks to Sam’s videos!)

    #49850
    Brian Lennon
    Participant

    I have been very impressed with how easy it was to import several thousand records from a previous database into Tap Forms 5. Adding pick lists, calculation fields and the like worked so well. There is one aspect I need advice on.

    The way I previously stored records of training completed by each person is one I need to change. (The previous TRAINING records only carried a course code and a person code.) So far I have managed to write a script that extracts the course codes for each person from a one-to-one linked field (“TRAINING”). Now what I want to do it insert these codes (“course_code”) into another many-to-many linked field (“TRAININGnew”) and I don’t know how to script this.

    Manually it works. I go to TRAININGnew, click on the little tick at the bottom that prompts “Select existing linked records”, I click on the course code from the linked form COURSES and the relevant course code and details appear in TRAININGnew. I need the script equivalent of this action. So my question is, how do I script this so that it will use the course_code extracted from TRAINING and select an existing course record identified by this course code in the TRAININGnew link so that the full course details will appear in the TRAININGnew link.

    Many thanks

    Brian Lennon

    #49849

    In reply to: Convert 2 fields

    Glen Forister
    Participant

    Ok, my Ft filed is a Number record.
    My meter filed is a Script field.

    It doesn’t do anything.  At least there isn’t a error.  I’m not checking the field for being empty because that is beyond me.  Trying to do one step at a time.  (in a test bed Form).

    This is the code.

    
    
    function Meter() {
    
    // Get the current record
    
    // Replace "sourceField" and "targetField" with the actual field names in your form
    var ft_id = 'fld-50c724b718da4b6dbcb64556bcec55d9';
    var sourceValue = record.getFieldValue(ft_id);
    
    // Perform the conversion (e.g., convert from inches to centimeters)
    var conversionFactor = 2.54; // 1 foot = 0.3048 meters;
    var targetValue = sourceValue * conversionFactor;
    
    // Update the "targetField" with the result
    var meter_id = 'fld-21efc0b907ac4d14871fcb9cccb22e2b';
    var FieldValue = record.getFieldValue(meter_id);
    
    // Save the record to apply the changes
    form.saveAllChanges() ;
    
    }
    
    Meter();
    
    
    #49848

    In reply to: Convert 2 fields

    Brendan
    Keymaster

    You will need to check to see if the target field is empty or not before doing the conversion. And it will be executed every time you make a change as long as this code is a Field script and not a Form script. A Field script is one that’s added as a regular field to your form, but can contain script code. A Form script is one you add to the Scripts tab on the Form inspector panel.

    #49829

    Topic: Convert 2 fields

    in forum Script Talk
    Glen Forister
    Participant

    I have 2 fields “feet” and “meters” which relate to the elevation of a location of a record.

    I often have feet, or meters but not both.  I want a script (I assume to put in the “Script” tab of that form to check if a record has one of the fields not empty, then to convert to the other field.  If both fields are not empty, leave it alone.

    I asked ChatGPT and it gave me this to do a simple conversion to see if I could get started and I pasted in between the Function Names.

    My first stumble was I couldn’t find the command in the directory of Script commands in the first statement  “form.getSelectedRecords()[0]”.  Do I insert something in the ()?  I asked in the other forum, but couldn’t get any script help there.  I think I understand how to put in the “sourceField” and the “targetField”.

    function Convert_Elev() {

    // Get the current record
    var record = form.getSelectedRecords()[0];

    // Replace “sourceField” and “targetField” with the actual field names in your form
    var sourceValue = record.getFieldValue(“sourceField”);

    // Perform the conversion (e.g., convert from inches to centimeters)
    var conversionFactor = 2.54; // 1 foot = 0.3048 meters
    var targetValue = sourceValue * conversionFactor;

    // Update the “targetField” with the result
    record.setFieldValue(“targetField”, targetValue);

    // Save the record to apply the changes
    record.save();

    }

    Convert_Elev();

    Convert_Elev() {

    // Get the current record
    var record = form.getSelectedRecords()[0];

    // Replace “sourceField” and “targetField” with the actual field names in your form
    var sourceValue = record.getFieldValue(“sourceField”);

    // Perform the conversion (e.g., convert from inches to centimeters)
    var conversionFactor = 2.54; // 1 foot = 0.3048 meters
    var targetValue = sourceValue * conversionFactor;

    // Update the “targetField” with the result
    record.setFieldValue(“targetField”, targetValue);

    // Save the record to apply the changes
    record.save();

    }

    Convert_Elev();

    #49827
    Glen Forister
    Participant

    I want to test a script, but not in my original form.

    How do I make a copy of my form with just a few or all of the records so I can test something?

    I’ve tried saving an archive of the form and changing the name on it and importing it, but it just disappears – were the empty records imported into the current form from which it came???

    I’ve tried making a copy of the form, but that form is empty.  How do I get some data into the copy form without making up stupid data with a lot of work?

    What is the best procedure here?

Viewing 15 results - 451 through 465 (of 2,951 total)