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,441 through 1,455 (of 2,952 total)
  • Author
    Search Results
  • Sam Moffatt
    Participant

    I concur with Daniel that you can’t do this with a calculation inside the table but you can do it in a script outside of the table. I tried quickly trying to get a script field to work in a table but I couldn’t get it to execute at all.

    Doing it outside of the table you just need to get the value of your servings field, get the records from the table and then iterate through them to set a total amount field that multiplies the servings by each rows per serving amount.

    var servings = record.getFieldValue('fld-5cb7ea19fa144112be17f4fb52699102');
    var table = record.getFieldValue('fld-b9927271feeb4fe2b9c0cd32f36c7cd1')
    for(line of table) {
    	var per_serving_amount = line.getFieldValue('fld-3fead523555c48f9a77377fd340e59f6');
    	line.setFieldValue('fld-e561de624cb1448a83399ab94a1b9e00', per_serving_amount * servings);
    }
    
    document.saveAllChanges();
    

    As a script field that did the trick for me, replace your field names to match the servings side, the table field IDd, the per serving amount and the total serving required field (or how ever you name it).

    Daniel Leu
    Participant

    The error message provides a hint: Rate limit exceeded

    Assuming you are using the free tier (https://devs.upcitemdb.com/), the limit is 100 combined requests / day. It looks like you have performed more requests than it is supported for the free tier.

    I would wait until tomorrow and try again. Otherwise, check that in your form you perform this lookup only once and not for all records.

    Using your link, I get a valid response. So this part of the code is correct:
    {"code":"OK","total":1,"offset":0,"items":[{"ean":"0786936203387","title":"Inspector Gadget 2 (DVD)","description":"Inspector Gadget 2 (DVD)","upc":"786936203387","brand":"Disney","model":"08966391","color":"Multi","size":"","dimension":"7.8 X 5.5 X 0.5 inches","weight":"0.3 Pounds","category":"Electronics > Video > Televisions","currency":"","lowest_recorded_price":0.01,"highest_recorded_price":88.88,"images":["https://i5.walmartimages.com/asr/e55d6d37-50d5-4f2e-ab37-e4d83327452c_1.52c7c6439bb862c70630e3116603d231.jpeg?odnHeight=450&odnWidth=450&odnBg=ffffff","http://c.shld.net/rpx/i/s/pi/mp/32762/2379601111?src=http%3A%2F%2Fwww.toysrus.com%2Fgraphics%2Fproduct_images%2FpTRU1-18918266dt.jpg&d=d8d439b1c37fe648b4cb233596449c271086b791","https://pisces.bbystatic.com/image2/BestBuy_US/images/products/4937/4937377_sa.jpg","https://target.scene7.com/is/image/Target/GUEST_2d8658d9-9a48-4370-b0c0-81f82098d03f?wid=1000&hei=1000","http://d3d71ba2asa5oz.cloudfront.net/13000046/images/xp16disd28554d__1.jpg","http://dynamic.indigoimages.ca/dvd/786936203387.jpg?width=200&maxheight=200","https://images10.newegg.com/ProductImageCompressAll200/786936203387-02.jpg","https://tshop.r10s.com/bcc/d8a/48ec/2739/807a/5ecb/e19a/1190e793322c600c7373af.jpg?_ex=512x512","http://www.fye.com/amgcover/dvd/full/t2/45/t24575lhows.jpg","http://www.secondspin.com/amgcover/dvd/large/t2/45/t24575lhows.jpg"],"offers":[{"merchant":"DealYard","domain":"dealyard.com","title":"INSPECTOR GADGET 2 (DVD/1.66)","currency":"","list_price":"","price":12.43,"shipping":"","condition":"New","availability":"","link":"https://www.upcitemdb.com/norob/alink/?id=v2q253t2v2z284a4u2&tid=1&seq=1614639577&plt=320d6f9194c9f0c32b30ab7b7f6261ea","updated_t":1484913282},{"merchant":"Indigo Books & Music","domain":"chapters.indigo.ca","title":"Inspector Gadget 2","currency":"CAD","list_price":"","price":9.99,"shipping":"Free Shipping","condition":"New","availability":"Out of Stock","link":"https://www.upcitemdb.com/norob/alink/?id=u2w24313y2436484&tid=1&seq=1614639577&plt=27ef67db080fc260bbd78e3fa1877f89","updated_t":1425355506},{"merchant":"Newegg.com","domain":"newegg.com","title":"Inspector Gadget 2 (2003 / DVD)","currency":"","list_price":"","price":10.66,"shipping":"Free Shipping","condition":"New","availability":"","link":"https://www.upcitemdb.com/norob/alink/?id=u2v233t20313e4b4v2&tid=1&seq=1614639577&plt=f0a036a392cfa6d3e0678def3d8e14f8","updated_t":1541678901},{"merchant":"Sears","domain":"sears.com","title":"Inspector Gadget 2 DVD","currency":"","list_price":"","price":7.99,"shipping":"","condition":"New","availability":"","link":"https://www.upcitemdb.com/norob/alink/?id=13s22303y2z2a464&tid=1&seq=1614639577&plt=f49b8656814deabcee725ffe920924ed","updated_t":1425627944},{"merchant":"Rakuten(Buy.com)","domain":"rakuten.com","title":"Inspector Gadget 2","currency":"","list_price":"","price":11.18,"shipping":"","condition":"New","availability":"","link":"https://www.upcitemdb.com/norob/alink/?id=u2o263t223439494v2&tid=1&seq=1614639577&plt=0d3d67d427c1d7dda095cae2f733528a","updated_t":1590589921},{"merchant":"Best Buy","domain":"bestbuy.com","title":"Inspector Gadget 2 [DVD] [2003]","currency":"","list_price":"","price":7.99,"shipping":"","condition":"New","availability":"","link":"https://www.upcitemdb.com/norob/alink/?id=w2w233z203z2b464&tid=1&seq=1614639577&plt=8d25e14eae609331acfe38bfd080527f","updated_t":1581124811},{"merchant":"Fye.com","domain":"fye.com","title":"Inspector Gadget 2 (new)","currency":"","list_price":"","price":3.99,"shipping":"","condition":"New","availability":"","link":"https://www.upcitemdb.com/norob/alink/?id=w2x2x2z2w263d444&tid=1&seq=1614639577&plt=7d22214db23f7e760e61a499a3080cd4","updated_t":1514927053},{"merchant":"SecondSpin.com","domain":"secondspin.com","title":"Inspector Gadget 2 (used)","currency":"","list_price":"","price":4.47,"shipping":"","condition":"New","availability":"","link":"https://www.upcitemdb.com/norob/alink/?id=x2u253z24303f484&tid=1&seq=1614639577&plt=6f37c48e61dc68d082b815a5cc1c8c8a","updated_t":1438967295},{"merchant":"Wal-Mart.com","domain":"walmart.com","title":"Inspector Gadget 2 (DVD)","currency":"","list_price":"","price":34.85,"shipping":"Free Shipping","condition":"New","availability":"Out of Stock","link":"https://www.upcitemdb.com/norob/alink/?id=y2s203x2v2136484&tid=1&seq=1614639577&plt=08df9e37bdb4924e4cf0fdd361528a52","updated_t":1614631925},{"merchant":"Justice & Brothers","domain":"shopjustice.com","title":"Inspector Gadget 2","currency":"","list_price":"","price":8.16,"shipping":"Free Shipping","condition":"New","availability":"Out of Stock","link":"https://www.upcitemdb.com/norob/alink/?id=y2x223z2036364a4&tid=1&seq=1614639577&plt=4cce5d463adc3ecacdd4f3e55114f155","updated_t":1413349795},{"merchant":"Alibris","domain":"alibris.com","title":"Inspector Gadget 2","currency":"","list_price":"","price":2.69,"shipping":"","condition":"New","availability":"","link":"https://www.upcitemdb.com/norob/alink/?id=z2q2y203y233a454&tid=1&seq=1614639577&plt=d7ff038f8364eccb45b896fb105e5dce","updated_t":1552399841},{"merchant":"Alibris UK","domain":"alibris.co.uk","title":"inspector gadget 2","currency":"GBP","list_price":"","price":5.69,"shipping":"","condition":"New","availability":"","link":"https://www.upcitemdb.com/norob/alink/?id=x2q2z2034323b474s2&tid=1&seq=1614639577&plt=7c325406675b24455fb6c8915e58852f","updated_t":1552399372},{"merchant":"DVD Planet","domain":"dvdplanet.com","title":"Inspector Gadget 2 - DVD","currency":"","list_price":"","price":8.61,"shipping":"","condition":"New","availability":"","link":"https://www.upcitemdb.com/norob/alink/?id=13v203z2z233a4c4&tid=1&seq=1614639577&plt=fef5e0755c97d0fc72bc6537310c2582","updated_t":1459397118},{"merchant":"Toys R Us","domain":"toysrus.com","title":"Inspector Gadget 2 DVD","currency":"","list_price":"","price":7.99,"shipping":"","condition":"New","availability":"","link":"https://www.upcitemdb.com/norob/alink/?id=13v213z2x26374b4&tid=1&seq=1614639577&plt=bab479317d2b80a85d0cc5500c0711ac","updated_t":1422850223},{"merchant":"Target","domain":"target.com","title":"Inspector Gadget 2 (DVD), movies","currency":"","list_price":"","price":9.99,"shipping":"","condition":"New","availability":"","link":"https://www.upcitemdb.com/norob/alink/?id=u2q223w2w2z274c4q2&tid=1&seq=1614639577&plt=4d9f2eed14331d22bdd1b31b087e840a","updated_t":1589179984},{"merchant":"11 Main","domain":"11Main.com","title":"INSPECTOR GADGET 2","currency":"","list_price":"","price":10.9,"shipping":"","condition":"New","availability":"","link":"https://www.upcitemdb.com/norob/alink/?id=u2r2y2v2v223d4a4y2&tid=1&seq=1614639577&plt=3ddf259952383c107395dfde73dd125c","updated_t":1437986473},{"merchant":"Pricefalls.com","domain":"pricefalls.com","title":"Inspector Gadget 2 DVD/1.66","currency":"","list_price":"","price":10.52,"shipping":"","condition":"New","availability":"","link":"https://www.upcitemdb.com/norob/alink/?id=v2q25313w2239484v2&tid=1&seq=1614639577&plt=d681005c829b35d904ad6aba11c00635","updated_t":1484934730},{"merchant":"Betamonline.com","domain":"betamonline.com","title":"Inspector Gadget 2 (DVD)","currency":"","list_price":"","price":5.85,"shipping":"","condition":"New","availability":"","link":"https://www.upcitemdb.com/norob/alink/?id=v2r2y2130353b494w2&tid=1&seq=1614639577&plt=649c5f126f4db5bb636387661ce30edf","updated_t":1484940186},{"merchant":"Jet.com","domain":"jet.com","title":"Inspector Gadget 2","currency":"","list_price":"","price":7.99,"shipping":"","condition":"New","availability":"","link":"https://www.upcitemdb.com/norob/alink/?id=w2s213x22303c4d4u2&tid=1&seq=1614639577&plt=b207ff0afe233c527fb7cc00b9d6b11c","updated_t":1536543457}],"asin":"B0000764K0","elid":"133512645732"}]}

    Cheers, Daniel

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

    Daniel Leu
    Participant

    I don’t know if this is possible, but you could do this calculation in a script.

    Cheers, Daniel

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

    Ray Robillard
    Participant

    Oops… made a few mistakes in my explanation :

    The script is NOT attached to bar code. It was attached to a different field. When I tried to attached it to bar code, I can’t get bar code to scan (it can’t be tapped).

    However, the error remains on the info website.

    So my questions :

    a) How to implement this
    b) does the website still works.

    Ray Robillard
    Participant

    Hi !

    I’ve created my movie database and now I’m ready to automate data entry with the script example “Fetch Movie Data from Web Service” found here : https://www.tapforms.com/help-mac/5.3/en/topic/scripts (near the bottom of the page)

    I’ve created the required fields which my database didn’t have (genre, link, barcode).

    I’ve copied the script from the web into a script attached to bar_code field. I’ve adapted the script so it uses my own database field IDs (so far, so good!)

    Synced the database with my iPhone. Added a new record, then tap on bar code field, used the scan bar code option and it actually scanned the bar code. However, no field were populated. So I manually checked the web url from where the data is fetched and I got this error :

    {“code”:”EXCEED_LIMIT”,”message”:”Rate limit exceeded”}

    The full URL is : https://api.upcitemdb.com/prod/trial/lookup?upc=786936203387

    Movie really exists and can be found on Amazon.ca website. This is the link I get when I manually enter the UPC : https://www.amazon.ca/s?k=786936203387&ref=nb_sb_noss

    So my questions :

    1) Did I do everything correctly ? Script attached to a field, and when data is entered in that field, the script is triggered and should search and find the metadata I need ?

    2) Is the website used in the sample still working ?

    Thanks,

    Ray

    Attachments:
    You must be logged in to view attached files.
    #43563
    Mike Sturmey
    Participant

    Thanks Sam & Brendan,

    It all seems to be working well apart from one thing. If I add new items to the Picklist i.e add a new Genus and associated species, when I call the script from the button the new list of Genus does not show the new addition. I have tried quitting and relaunching but it does not help. It is a bit weird as the script does not require adding any specific data associated with the pick list. Is there a way of refreshing the list – it is almost as though it is cached,

    kind regards
    Mike

    #43545
    Daniel Leu
    Participant

    Hi Ken,

    If you use the ‘alias’ option when attaching a new file, then the size of the database doesn’t grow much. But that would be cumbersome to do for all 10,000 files you have.

    Please contact me at daniel AT danielleu.com to discuss technical details to automate/script file linking.

    Best,
    Daniel

    Cheers, Daniel

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

    #43539
    Daniel Leu
    Participant

    Yes, you can do this. Use a field with the type “Web Site” and set the link like file:///Users/ken/Desktop/Plans/plan_1001.pdf. Whenever you click on the globe icon, your PDF file will be opened. You have to give TapForms permission to access that directory in Preferences -> Script Folder Access. The permission is granted to all enclosed directories and files.

    To set the URL path, you might want to use a JavaScript field to set it based on the “Plan No.” field.

    Cheers, Daniel

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

    #43529
    Chris Ju
    Participant

    Hi Brendan,

    did you ever thought about adding a feature with which one can map new fields (of an import file) to existing fields of the form?

    At the moment i run a script on a saved search to copy imported field values to target fields.

    Thanks
    Chris

    #43504
    John Eckenrode
    Participant

    Is there a script, or another way, to reposition a photo within the bounding box in a form layout?

    In other words, I have a layout for an art collection catalog.
    I have a square bounding box for the main photo on the layout page.
    I want to align the photos to the top of the bounding box.
    Tap Forms defaults to centering the photo within the bounding box.
    I want it to align to the top of the box.

    This a purely aesthetic change I’d like to execute–to make the layout nicer/cleaner/more consistent
    with differing art aspect ratios and orientations.
    Not a must have, but a “it would be nice” to have.

    Any ideas how to do this? Is this even possible?

    #43490
    Sam Moffatt
    Participant

    I think this with a bit of work could be interesting with the embedded aspect. I think the ability more generically to be able to render a point, or set of points, over an image is useful. I think that’d be interesting for layouts that are intended to be printed (custom or default) and would see that as a useful improvement for the current location field type as well where the base image is sourced from Maps (maybe have to use OSM data for legal reasons). I think it requires some thought to zoom and cropping considerations with the rendered images and point overlay but I could see a use for this feature. I think at least an improvement to be able to print a map for the current location field would be useful and then from there this feature isn’t too far away.

    One other thing I’ve wanted for a while is a polyline feature for overlaying a series of points on a map for mapping road trips. I’ve done the individual points as an import and overlaid that in the map mode but the point aggregation messes with making it a smooth line. In that case it’d be a single parent record and a series of child points (perhaps modelled like a table field with a map renderer and the option to connect points).

    The major aspect is the ability to compose a point over the top of an image which can be done for maps today but can’t be done with custom imagery. That just made me wonder about custom tilemaps for something like Minecraft map renders but that’s a much larger can of worms and definitely out of scope.

    It occurs to me that a while back someone was using a custom layout to do a similar sort of use case except with seating arrangements. I think that might have been Gregory where he used a base image and then overlaid fields to get a sort of seat map effect. One might be able to replicate something like that with this where each record represents a seat and you get a visual map of where that seat is. Taking that one step further if a version of the map view was used you could click to select records using a seating layout as a base to pan around. The next step could be to create a three form layout: seat, ticket and show. Seat is that original use case, ticket could be expanded to include a link to seat and perhaps a script field to automatically extract the seat location from the linked seat record into an equivalent field in the ticket and then a show allows filtering the tickets by show through another link so that you can display all of the seats sold for a show. One could conceive of using a similar sort of setup for a restaurant though it has a temporal aspect potentially as well (which would be another level of awesomeness, time window slider + map overlay to filter records).

    I already do something similar for the scripting where I have a set of “known” locations and use that to automatically populate a location field in a form using a field script. I type into the location field a known location name and it replaces the field with the fixed location.

    As an aside, I built a thing like this many moons ago for a library use case for mapping back where a book was in a library. When you found a book you were interested in, you could click a button and it’d show you were the book was in the library. In that situation I ended up precomposing images mapping to shelves however I would have killed for today when location services on mobile devices is much more accurate to do a really cool find the book experience.

    That ended up longer than I expected…

    #43480
    Daniel Leu
    Participant

    You are using Sam’s script as a field script, but I think you would want to use it as a form script.

    Then in your custom layout, you can create a button to run that script.

    And the field type for ‘Epiphytic cactus’ should be text.

    Cheers, Daniel

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

    #43478
    Mike Sturmey
    Participant

    Hi Sam,

    I have managed to get your script working (to some degree with next to zero Javascript knowledge) however I have got to a point that I am really stuck and wondering if you could assist – I have attached the form.
    The issues are:
    When I create a new record, the field is automatically populated with ‘[object Promise]’ – I would like it to be empty.
    The script seems to run multiple times (for the number of records in the DB) instead of just once.
    The script replaces all the values of all the records – not just the one I am editing.

    If you could assist it would be great
    cheers
    Mike

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

    So, I haven’t worked out how this would be done exactly in JavaScript, but in general what I would do is first insert the current date value into my array, then sort the array. Then find the index of the current date (in objective-c it would be something like NSInteger currentDateIndex = [array indexOfObject:currentDate]), then to get the before date, just index into the array with array[currentDateIndex - 1] and the after date array[currentDateIndex + 1]. Doing appropriate bounds checks first of course.

    #43451
    GLS
    Participant

    Hello,
    For an invoicing DB I created a layout in which I would like to add a field to select the client, which will populate the address, and potentially get all the items to be billed if there is something like “onChange” for the address field to trigger the script that imports what is to be billed.

    Hiding the “client” field in the print dialog does not remove the field from the printout.

    Thank you

    GLS

Viewing 15 results - 1,441 through 1,455 (of 2,952 total)