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 - 556 through 570 (of 2,951 total)
  • Author
    Search Results
  • #49285
    Charlie
    Participant

    Thanks Daniel.

    It’s almost there. I have some duplicates of similar names. Like ljud: Ljud, Ljus: ljus, kamera… etc. Alson i have checkmarkfield ”inkommen” marked true or false. I wonder how to, not have ”inkommen”, true in the mail. Signature is jpeg file that the script cant translate. Small issues could be big script problems. Any way Happy easter.

    #49260
    Charlie
    Participant

    Hi Daniel

    Thanks for your support. I got the name and all the field that is not linked to other forms to be copied to mail. That’s great. I also tried to test to change field 32. But i don’t get info from other forms. Like ”kameror”, ”ljud”, ”grip” and so on. I am useless to script writing Thanks for your time and work.

    #49259
    Daniel Leu
    Participant

    Hi Charlie,

    Thank you for the form. I’ve enhanced the script a bit to process date fields as such, include the name field from the contact, and to report child records as well. Please note that I only did some minimal testing.

    I have updated the script over on https://lab.danielleu.com/blog/sending-record-by-email/

    Your top-form contains links from other forms and not to other forms! You will need to update line 32 from } else if (f.fieldType == "form") { to } else if (f.fieldType == "from-form") {.

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #49250
    smartin
    Participant

    We gave it a try at coding and came up with what I will paste below. Unfortunately we’re getting a Syntax Error —> Permute_Short_Prints: SyntaxError: Unexpected end of script, line:78

    note: line 78 is the final line of the code.

    here’s the code. thanks to anyone looking it over and feeding back where we’ve gone wrong!

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    
    // Here goes nothing! We're going to try some Tap Forms Java to make a permutation of short print variants in our 2022 Topps Series One Form;
    // First we will define the Short Print field Id's from this Short Print Form with the following variable names using the const instruction;
    
    		const shortPrintId = form.getFieldNamed("Short Print").getId();
    		const superShortprintId = form.getFieldNamed("Super Short Print").getId();
    		const ultraShortprintId = form.getFieldNamed("Ultra Short Print").getId();
    
    // We'll call this script the Permute_Short_Print;
    // I don't know if this is where the function instruction should be placed, but here it is;
    
    function Permute_Short_Prints() {
    
    // These variables probably can (should?) be declared here outside of the search Loop (I think);
    // "2022 Topps Series 1" is another Form in the database with a full checklist of available cards (minus all of the permutations of variants);
    
    		const seriesOne = document.getFormNamed("2022 Topps Series 1");
    		let seriesOneRecord = seriesOne.addNewRecord();
    
    // Now we'll Loop over the fields in the Short Print Form. This script will be placed at the Short Print Form level using script button;
    		
    	for (field of form.getFields()){
    
    		// We'll define these variables inside of the Loop. Not sure if it has to happen this way, but seems right.
    			let seriesOneFieldId=seriesOne.getFieldNamed(field.name).getId();			let seriesOneShortPrintId=seriesOne.getFieldNamed("Short Print");
    			let shortPrint = getFieldValue(shortPrintId);
    			let superShortPrint = getFieldValue(superShortPrintId);
    			let ultraShortPrint = getFieldValue(ultraShortPrintId);
    				
    			// This one additional variable will be used to set a flag in the seriesOne Table to sort for scripted entries (in case we need that later)
    			let seriesOneScriptAutoEntryId=seriesOne.getFieldNamed("Script Auto Entry");
    				
    				
    		// IF NUMBER 1 -- This first If Statement will create a record in the seriesOne Form for short prints called "SP";
    				if (shortPrint = "SP") {
    				// true condition;
    					seriesOneRecord.setFieldValue(seriesOneFieldId, record.getFieldValue( field.getId()));
    					seriesOneRecord.setFieldValue(seriesOneShortPrintId, record.getFieldValue(shortPrint));
    					seriesOneRecord.setFieldValue(seriesOneScriptAutoEntryId, "Y");				} else {
    				// false condition is to just move on;
    					continue;
    				}
    	
    		// IF NUMBER 2 -- This second If Statement will create a record in the seriesOne Form for short prints called "SSP", or SUPER short prints;
    				if (superShortPrint = "SSP") {
    				// true condition;
    					seriesOneRecord.setFieldValue(seriesOneFieldId, record.getFieldValue( field.getId()));
    					seriesOneRecord.setFieldValue(seriesOneShortPrintId, record.getFieldValue(superShortPrint));
    					seriesOneRecord.setFieldValue(seriesOneScriptAutoEntryId, "Y");				} else {
    				// false condition is to just move on;
    					continue;
    				}
    	
    		// IF NUMBER 3 -- This third If Statement will create a record in the seriesOne Form for short prints called "USP", or ULTRA short prints;
    				if (superShortPrint = "USP") {
    				// true condition;
    					seriesOneRecord.setFieldValue(seriesOneFieldId, record.getFieldValue( field.getId()));
    					seriesOneRecord.setFieldValue(seriesOneShortPrintId, record.getFieldValue(ultraShortPrint));
    					seriesOneRecord.setFieldValue(seriesOneScriptAutoEntryId, "Y");				} else {
    				// false condition is to just move on;
    					continue;
    				}
    		
    		// save 
    		seriesOne.saveAllChanges();
    
    // ...and we are done!;
    
    }
    
    Permute_Short_Prints();
    

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    • This reply was modified 2 years, 7 months ago by Brendan. Reason: Added back-ticks to the code
    #49245
    Ronald Kroeker
    Participant

    Daniel, Thanks for your patience.
    You were correct I had a typo 😔…I had written
    “CONCAT((Date[Date];yyyy-MMM-dd);[Name field])”
    I had bracket in wrong order and forgot quotes.
    Thanks again for the assistance.
    P.S. What is the correct formatting for long date?
    You had used yyyy-MMM-dd but would like to display full date? Haven’t ventured into scripting yet but will once I have finished my transition with tapforms.

    #49227
    Charlie
    Participant

    Daniel Thanks for the script. I have linked fields that don’t show up as they do on the computer. Even if i make a pdf the field don’t show the linked form. So at the moment i’m stuck. But thanks for support Daniel

    #49203
    Daniel Leu
    Participant

    Yeah, you could write a script or use the calculation field to strip “A “, “An “, or “The ” from the title string. The script or calculation would then return the shortened title on which you could perform your search.

    Using calculation seems to be a bit more complicated than using a script:

    function Stripped_Title() {
    	// Define Id of title field
    	const title_id = 'fld-dec6b20e27d343e181e37a813624b467';
    	let title = record.getFieldValue(title_id);
    
    	// Check for "A "
    	if (title.toLowerCase().substr(0,2) == "a "){
    		return title.substr(2)
    	}	
    
    	// Check for "An "
    	if (title.toLowerCase().substr(0,3) == "an "){
    		return title.substr(3)
    	}	
    	
    	// Check for "The "
    	if (title.toLowerCase().substr(0,4) == "the "){
    		return title.substr(4)
    	}
    }
    
    Stripped_Title();
    

    I don’t know if all your titles start with an uppercase character. So I translate them to lowercase to catch “a”, “an” and “the” as well. Good luck!

    • This reply was modified 2 years, 7 months ago by Daniel Leu.

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #49202
    Susan Chute
    Participant

    Hello there,
    I just want to say I am enjoying this database, which has solved many problems I previously had with LibreBase. I posted a good review in the Apple Store. It seems very robust. I’m not up to scripting in JavaScript yet (after all, I just finished learning SQL in the W3school for LibreBase). So my question is, I have a big database of poems. I want to sort it by title, but for the sort to ignore A, An and The. I know that you could probably write a script, but as of yet I don’t know how (start after 1st 2, 3, or 4 characters, maybe, is part of it?). Can you explain? or is there an easier way?
    Thanks for TapForms! Yay!

    #49178
    Charlie
    Participant

    is their a script to do what Brecht ask for? It would be much easier than Mail PDF and do it manually.

    #49165

    In reply to: Email Record?

    Glen Forister
    Participant

    Just look at in plain text. Like I’m talking with a person and telling them about a book – email him the record so he can find it.

    Or, I need to copy a record from one form to another. Can’t be done apparently without so much Script my head swims. So if I can email it to myself, at least I can copy and paste from my email to the other form.

    Thanks.

    #49163

    In reply to: Email Record?

    Glen Forister
    Participant

    I don’t want to email a record based on anything except the record I am looking at on my screen. I just want to email the record I am in and no other. This would have to be a Script that would work on any Form and send all the fields of that one record.

    I would also like it to work on my laptop as well as my iPhone.

    You say “Just email it as normal”. Do I copy the record? I don’t see a way to do that.

    Any ideas how this can be created?
    Thanks.

    #49159
    Glen Forister
    Participant

    Since I haven’t finished my training yet (http://www.asmarterwaytolearn.com/js/) I haven’t utilized your suggestion about copying a record from one Form to another Form.

    Instead of running a script to copy one record to a different form, I looked for something I used all the time in my old database but couldn’t find.

    Can go into a record on my iPhone and email that single record in text or html format to someone? This has been extremely useful for me in the past.

    I saw a recent Script discussion about emailing a record if it was a certain date, but it was way over my head and more complicated than just emailing the current record including all its fields with the field names?

    Any hints to do this?
    Thanks.

    #49127
    Daniel Leu
    Participant

    Re: Form script:

    You just need to loop over all your records and then assign the values on each one:

    
    function wc_attributes_update() {
    
      // definitions
      var year_id = 'fld-bcf37649c9ee4332b7100a9589110f96';
      ....
    
      for (rec of form.getRecords()){
        rec.setFieldValue(attribute_3_value_s_id, model);
        rec.setFieldValue(attribute_4_value_s_id, gauge);
        rec.setFieldValue(attribute_5_value_s_id, container);
        rec.setFieldValue(attribute_6_value_s_id, era);
        rec.setFieldValue(attribute_7_value_s_id, railroad);
        rec.setFieldValue(attribute_8_value_s_id, brand);
        rec.setFieldValue(attribute_9_value_s_id, collection);
        rec.setFieldValue(attribute_10_value_s_id, tca_grade);
      }
      form.saveAllChanges()
    }
    
    wc_attributes_update();    
    

    This example works on all the records. If you only want to update the ones from a saved search, you might use form.getSearchNamed('Genre: Action & Adventure').

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #49126
    Kirk Williams
    Participant

    <p>
    Does WooCommerce have a REST API? Maybe as you edit your data in Tap Forms, a script can use the Utils. postContentToUrlWithContentType() or Utils.postJsonToUrl() functions.
    </p>

    This is an interesting question, one that I’d need to investigate. I suspect there numerous APIs for WordPress in general; that would be the most likely point of entry for any transactional functions between TapForms & WooCommerce. I won’t lie, though – it already sounds like a project that is well beyond by coding expertise!

    <p>
    To avoid the refreshing issue, maybe instead of using a Field Script, use a Form Script and have it loop through your records, updating the exportable fields with the values from the regular fields. So when you’re going to export, just run the script first. Then it won’t be interrupting you while you edit the records.
    </p>

    Yes, this is precisely what I’ve been working on, but thus far have not been able to create with any success. Your suggestion that such a function is indeed possible is more than enough motivation for me to take another crack at it.

    Thank you for the suggestions!!!

    #49125
    Kirk Williams
    Participant

    Thanks for the suggestion Daniel!

    I know WC accepts CSV and XML; I feel like I’ve seen references to text imports but I’d have to dig into the documentation to confirm. Since it’s within the WordPress environment, I imagine there’s likely some security components that would prevent text-based script imports, but I may be able to circumvent those by tweaking the php settings. It’s an interesting angle – thanks!

Viewing 15 results - 556 through 570 (of 2,951 total)