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 - 1,816 through 1,830 (of 2,989 total)
  • Author
    Search Results
  • #41336

    In reply to: A Few Questions

    Christin White
    Participant

    3. That’s a really good point, I guess what I’m really looking for throughout most of these questions/requests are ways of streamlining UI/data manually and contextually to fit the use and provide more flexibility. The nice thing is that Tap Forms seems to do almost everything I want it to functionally, the underlying data isn’t limited so I can adopt it now and hope for some more presentation control in future versions.

    5. I was looking over the APIs after I posted that yesterday and it looks like it’s quite powerful, JS isn’t my favorite language in the world but getting better at it has long been on my todo list since JXA is used in a lot of my Mac automation tools and things like Scriptable and JSBox are so powerful on iOS if you want to go beyond just Shortcuts for automation (I like Python even less ?).

    Ah, I went back and looked at the edit form and couldn’t figure out how I was deleting instead of saving, spam filtering makes sense, thanks for clarifying that.

    #41335
    Victor Warner
    Participant

    I would like to combine a Notes field with other in a script, but if the Notes field is empty I wish to display just the other fields.

    I have created a test database with a test script as follows:

    var notes_id = 'fld-9d8543d9d39f409194349c1a855d7728';
    var notes = record.getFieldValue('fld-9d8543d9d39f409194349c1a855d7728');
    
    var new_work_address_id = 'fld-943ab25fd0de42e7b8d1e5487c6a358b';
    var new_work_address = record.getFieldValue('fld-943ab25fd0de42e7b8d1e5487c6a358b');
    
    if (notes == "") {
    
    result = new_work_address
    
    } else {
    
    result = new_work_address + "\n\n" + notes;
    
    }
    
    result

    But if the Notes field is empty the result is the content of new_work_address plus plus the word ‘undefined’

    Is there a way to test for whether a Notes field is empty?

    #41334

    In reply to: A Few Questions

    Sam Moffatt
    Participant

    2. I’ve thought for a while that a custom layout using the default layout view but with the ability to re-order fields and hide ones that aren’t important would be an interesting addition and could provide a form of custom layout support on the mobile platforms as well. I used section headings to collapse down records and keep them clean during editing though that isn’t a good fit for your use case.

    3. The problem is that those fields are still editable in the sense that they can create an entry on the other side of the link. I can see your use case though and I think an implementation path forward could be per record overrides for field settings which could hide the field just for that record via a script interaction (though that isn’t a feature that exists today).

    5. TF uses Apple’s JavaScriptCore for the scripting so almost anything you can do in JavaScript you can do in Tap Forms. Check out the JavaScript API for details about Tap Forms specific functionality but you can manipulate almost any data item in the application via the scripting interface.

    As an aside, editing the post generally gets caught by the antispam as that is a technique to change a post after it’s been visible to hide links in it. I’ve been caught a few times by it myself.

    #41331
    Sam Moffatt
    Participant

    That’s a limitation of that particular model because you can only link to a form record not an entry inside a table field. It looks like what you’re after is more the article than the magazine so if we pivot a little to make the ‘Articles’ their own form then you can skip the script and just use a Link to Field with JOIN and I think it’ll give you the read out you’re looking for.

    Here is a new TFArc with a new Articles form setup as a Link to Form JOIN to the Keywords form and also setup with a Link to Form 1:M from Magazine to map that back. Inside of Articles I added two calculation fields to map down fields from the Magazine form into the Articles one which can be seen in the list view in Keywords. The existing fields are still there but with some renames.

    Attachments:
    You must be logged in to view attached files.
    #41329
    Brendan
    Keymaster

    Hi Rocky,

    That’s interesting. I would have thought that if the record didn’t quality for the search results after the script is run, that’s why it would disappear. But you said that the script does not touch a field that’s in the list of search rules.

    Would you be able to email me your form template so I can test it out here?

    Thanks,

    Brendan

    #41326
    Rocky Machado
    Participant

    Hi Brenden – Not sure if this is by design, but thought I would ask. I currently have a Trade Journal form layout that has a button which executes a script. I noticed that when I’m in a search filter and execute the script via the button click. I noticed the transaction disappears from my search filter list and I have to hit the refresh (recalc the search filter) button in order for my transaction to show up on my list again. The filter criteria for my search is based on a date/time field (looking at today transactions). The fields that I’m populating has nothing to do with the search filter so I am not quite sure why the transaction would disappear (unless it event driven). Is this the expected behavior? So to make this work, I have to click the button and then hit the recalc button for the record to reappear. I’m wording if I am doing something wrong. When I execute the script I do a form.saveallchange() for my changes to take effect.

    thanks,
    rocky

    #41316

    In reply to: A Few Questions

    Christin White
    Participant

    Huh, okay, every time I try to edit my post it deletes it instead, sorry for the multiple pings, hopefully I’ve figured out the way to get the markdown to not collapse spaces and dashes, if not apologies for not being as clear as I’d like.

    Thanks Sam and Brendan!

    1. Brendan’s suggestion worked for me, If I have trouble in the future I may look at those other sync services.

    2. Hmm, that does make sense in this context and having a single form for media that can match some pre-selected types is a more elegant way to approach this, it just means each record will have a lot of superfluous fields specific to other types of media.

    I hadn’t played with custom layouts yet, having done so now I feel like it’s a bit clunky and page/print-centric for me, I definitely prefer the more responsive UI design of the default layout, it’s a pity that it can’t be duplicated but some fields simply hidden or even just section headings collapsed for each layout.

    3. That’s certainly a good idea but this was just an example, combining media types or people and companies into combined forms aren’t always going to work for every example, it would be nice if records could be toggled to simple hide unused inversely linked fields.

    4. Along the same lines it would be sweet if *Many to Many* relationships with only a single link could collapse to a non-table view or a *Many to One* option existed.

    5. I did a poor job articulating this but it looks like you got the idea. Basically, I want a tagging system tags can be nested and parent tabs inherent the items of their child tags like Bear does. So basically you get something like this:

    Parent Tag 1 (Record 1, Record 2, Record 3)
      Child Tag 1 (Record 1, Record 2)
      Child Tag 2 (Record 3)

    Bear does this by simple parsing tag names for slashes and extracting the tag structure from that but I’ve seen other apps implement it in other ways. Keep It does something that’s similar and creates some sort of implicit hierarchy from a flat list of tags. When you select a tag to filter by the tag panel then filters out any tags that aren’t designated in other items with the tag selected so you very quickly create structure through boolean unions.

    Regardless, assuming Tap Forms’ scripting is capable of parsing regex expressions, assigning and removing tags programmatically I think the functionality I’m looking for could be implemented that way. I’ll definitely take a look at that example and think through your suggestion further, I think I’m still missing a little contextual experience with the application to entirely understand but it sounds like it’s worth a try. Thank you!

    Tap Forms seems like an awesome system, while not quite as flexible as I would like for some things, I certainly realize I may be an outlier on how I want to use it. With some care in how I design things and a certain amount of clutter I think its worth the investment and will work for me.

    My goal was to move away from AirTable to something more native to the platforms I use every day and to escape the limits by subscription tiers and Tap Forms achieves both goals and does so quite well overall.

    #41312

    In reply to: A Few Questions

    Christin White
    Participant

    Thanks Sam and Brendan!

    Sam,

    1. Brendan’s solution seems to have resolved the issue for now, if I have more trouble with things in the future I may look into those other services.
    2. Hmm, I hadn’t considered this approach but having one form for all media seems like a more elegant solution than a bunch of forms, even if it means I have a ton irrelevant metadata for each record, I’m liking this better! I’m not much of a fan of custom layouts though, I hadn’t realized those were an option before you mentioned them but playing with it now it seems very paper/page-centric in design, not really UI-centric and responsive to different device screen sizes. I wish I could just take the default layout but just hide fields for each layout. I may play with this more but it seems to lack the elegance of the default layout. I’m definitely spoiled coming from AirTable in terms of design elegance, I just wanted something native and not limited by subscription pricing tiers.
    3. Good point, certainly, but that was just an example, combining things like media types or companies and individuals may not always make sense. I can work around this but it’s a shame there isn’t more control.
    4. I get that but it’s a pity it doesn’t collapse the table if there’s only a single relationship or a many to one option.
    5. I’ll take a look at your scripting, I was having trouble describing the system in a clear way. Basically, I want a tagging system sort of like this

    
    Parent Tag 1 (record 1, record 2, record 3 - collected/reverse inherited from children)
      Child Tag 1 (record 1, record 2)
      Child Tag 2 (record 3)
    

    Bear parses tags by just using slashes in the tag names like Development/Languages/Javascript but that’s only one approach. Keep It for instance doesn’t do hierarchical tags but if you filter by a tag the tag panel will then show you other tags that associated with items that has that tag so hierarchy can be implied through boolean unions.

    A programmatic solution where any record that is assigned Child Tag 1 would automatically tag it with Parent Tag 1 would certainly work if Tap Forms’ scripting support is robust enough parses regex expressions, assign and remove tags, it sounds like it is.

    I need to explore a little more, look at that keyword mapping and figure out what you’re suggesting a bit better when I have more context.

    While not as flexible in some ways as I would like it seems like Tap Forms will work for me and is worth the investment, it is an awesome system and I realize I’m probably an outlier for some of the ways I want to use it

    #41306
    pierrot_rennes
    Participant

    Hi Sam,

    I put only one keyword per article to keep it simple
    If I really need a second keyword for the same item, I create a second record
    Apparently, your script works according to my need.
    I will test by adding some articles.
    If it’s ok, I will start from your model to modify your form and adapt it to my needs
    A big thank you for your responsiveness, I will tell you when it’s good

    #41302

    In reply to: A Few Questions

    Sam Moffatt
    Participant

    Hi Christin,

    Responding as a regular user, some of these will require Brendan’s input.

    1. I suggest looking at CouchDB or Cloudant as the sync system, I’ve found CouchDB to be reliable and if you’ve only got a small amount of data the IBM Cloudant free tier I think gives you 1GB of space to use (CouchDB is an open source server and Cloudant is IBM’s hosted version of it).

    2. I’d probably leave all of those fields in a single form with a “type” field and then use custom layouts to control which quote you saw. It won’t work so well on the table view but a workaround would be to use either a calculation field or a script field to compose the text relevant to the record type, perhaps like a bibliography line generator. You click add, in the ‘quotations’ form select the right layout for th type, put in the data and then you can go back to the parent form.

    3. Companies are people too, at least in the US anyway. I’d actually take inspiration from Apple’s approach where if a contact card is a company is a tick box for the contact card and everything else more or less remains the same. You can still filter and search on if something is a company or not and if you bump it up your field list after name, you can have it render in the list view as well (I’d also tick “show field name” on the checkbox as well). I don’t think you can hide the UI if there is nothing there.

    4. Many to Many implies both sides could have multiple entries though, that’s why it’s displaying the table because there is the possibility that multiple records will be available or another one could be added even if there is currently only a single record.

    5. I’m not sure I fully understand so my apologies if I’m off base but what might work for you is something not dissimilar to what I just threw together for Pierrot for his keywords mapping for magazines. Some amount of scripting could help automate building the linking structure you’re interested in achieving though I must admit I’m not sure I fully understand it. There are a couple of ways of structuring the forms to use calculation or script fields to create surrogate field values (e.g. take the name of the current level such as Habits and then prepend a field with the name of it’s parents) which if set to be the first field shows up in the flat list but can maintain the parent association via a 1:M link. Then I’d probably use a normal Link to Form M:M field to map the children of each of the category records to it’s categories that is maintained by a script. You could brute force like the above script or a field script might also work to detect links being manipulated and to automatically propagate adding/removing the links internally.

    Hopefully that makes sense, I’m sure others on the forums might have different takes and Brendan often chimes in with features that are built in that might handle some of it. I think with some scripting support you can get a little bit further.

    #41299
    Sam Moffatt
    Participant

    If you only had one keyword, then I think a JOIN link to field type would work for you because you could have a single “keyword” record and then it’d automatically JOIN on other records. If you made “articles” it’s own form and used “Link to Form” fields to join it all together then that would work. You’ve gone with a table approach which can’t be used to handle the JOIN.

    If you wanted to keep the table, what could work is to leverage a script to maintain the links. I did a really quick one here;

    function Build_Keyword_Map() {
    	// This is the other form that has our keywords in it.
    	let keywordForm = document.getFormNamed('Keywords');
    	
    	// This is the field ID in the "keywords" form for the link to field to Magazines.
    	let magazines_id = 'fld-b4724a28d4094b3faa9910f18374588f';
    
    	// This is the field ID in the "keywords" form for the keyword field.
    	let keywords_keyword_id = 'fld-ebaf7ffa3d484834bdcc34d3ffb9c5f2';
    	
    	// This is the field ID in the "magazine" form of the table.
    	let articles_id = 'fld-dca513dfa3894e8aaa3792a9eb09b106';
    	
    	// This is the field ID in the "magazine" form for the keyword field in the articles table.
    	let keyword_id = 'fld-055da0f29f764ea399e6f317427ff8ed';
    
    	// This is to store a map of keyword to keyword record.
    	let kwRecords = {};
    
    	// Build the map of keyword to keyword record (cache if you will).
    	for (let keywordRecord of keywordForm.getRecords())
    	{
    		kwRecords[keywordRecord.getFieldValue(keywords_keyword_id)] = keywordRecord;
    	}
    
    	// Iterate over every record in this form...
    	for (let sourceRecord of form.getRecords())
    	{
    		// And iterate over each row in the articles table...
    		for (let article of sourceRecord.getFieldValue(articles_id))
    		{
    			// Get the value of the keyword field...
    			let keyword = article.getFieldValue(keyword_id);
    			
    			// Skip it if it is empty...
    			if (!keyword)
    			{
    				continue;
    			}
    
    			// Check if a keyword record exists for it...
    			if (!kwRecords[keyword])
    			{
    				// Create keyword record if it doesn't exist...
    				console.log('Creating keyword record');
    				kwRecords[keyword] = keywordForm.addNewRecord();
    				kwRecords[keyword].setFieldValue(keywords_keyword_id, keyword);
    			}
    			
    			// Link the keyword record to this record.
    			kwRecords[keyword].addRecordToField(sourceRecord, magazines_id);
    			
    			// Save the changes to make sure the link persists properly...
    			form.saveAllChanges();
    			
    			// Log the keyword we processed, we're done!
    			console.log(keyword);
    		}
    	}
    }
    
    Build_Keyword_Map();

    There are comments throughout which should explain what it does and I’ve attached a sample archive with the script in it inside the “Magazine” form. You can play with it to get it to add links. What it doesn’t do right now is handle if you delete or remove a keyword. You’d also have to do a split or similar to do a comma separated list of keywords as well but this is a quick example of how you can use scripting to build that link.

    If you change from a table to a child form then you could link a single keyword easily. If you wanted to do multiple keywords (e.g. Big Sur, Photos) then you’d be back needing a script again.

    Hopefully this helps :)

    Attachments:
    You must be logged in to view attached files.
    #41279
    Roy Helsing
    Participant

    I am new to TAP, and made a simple relational database for a lost of music I can play, attached to the genres that relate to that music. I want to be able to print a report for my customers that lists each genre and under it, all song titles that are related tot hat genre. It appears the thinly way to do that iw with a script – which I read about at length yesterday only to decide Java Script is not in my wheel house. Does anyone have a simple script they use to list related items under a field that could share? I think i am able to figure out how to replace the fields in someone script with my one. I am looking for a report that reads like this:

    GENRE 1
    Song 1
    Song 15
    Song 432
    Genre 2
    Song 15
    Sonf 321
    Genre 3
    Song 1
    Song 12

    #41263
    Sam Moffatt
    Participant

    You can use any of the scripts I wrote with pick lists. You just need to define the two pick lists in the Tap Forms preferences for your document and assign each of the text fields to the correct pick list. Make sure you use a single value select list type (e.g. single value popover, combobox, popup button or radio) because the multivalue varieties would mess up the mapping.

    #41257
    Brendan
    Keymaster

    Oops. Actually you’re right. Because the script doesn’t get executed until you select from the first pick list. Darn.

    #41249
    Brendan
    Keymaster

    I know it’s not the same as what you’re doing, but I did once write a script that switched pick lists depending on the value selected from another Pick List. This script switches between a Canadian Provinces and US Sates Pick List depending on the value of the country selected.

    function Province_Pick_List_Switcher() {
    
    	var country_id = 'fld-de7985c881804154b037c68dc4c24414';
    	var country = record.getFieldValue(country_id);
    	var canadian_provinces_pick_list = document.getPickListNamed('Canadian Provinces');
    	var us_states_pick_list = document.getPickListNamed('US States');
    	var province_id = 'fld-b1458c16690744129ff145f7b9607c99';
    	var province = form.getFieldWithId(province_id);
    	
    	if (country == 'Canada') {
    		province.pickList = canadian_provinces_pick_list;
    		
    	} else if (country == 'United States') {
    		province.pickList = us_states_pick_list;
    		
    	} else {
    		province.pickList = null;
    	}
    	
    }
    
    Province_Pick_List_Switcher();

    It worked well, but only with the Single and Multi-Valued Pick Lists. Because those fetch their Pick List values when you display the popover as opposed to the Checkbox, Radio Button, Combo Box, etc., which pre-load all the values to display.

Viewing 15 results - 1,816 through 1,830 (of 2,989 total)