Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Relationship and Scripting - Assistance Request

Featured Replies

  • Newbies

Hiya,

1st of all - I have personally refrained from posting for help on a forum as I wanted to try and read, learn and solve my problems using trial and error! I am learning the FMP platform from scratch and am currently in week 2 of it.

My question relates to a file I have attached to this post - the products area.
For each product I have a number of 'size options' within it and each with their own unique SKU (stock keeping unit). Each SKU needs its own barcode. My job now is to produce a method to easily assign an 'available' barcode to a specific SKU.

Barcodes are purchased from GS1 and are globally unique. I have a table hosting a pool of barcodes that I have available to me. They can only be assigned to one SKU and once assigned, needs to be removed from the available selection of barcodes in this pool.

Issues
I wanted to set a placeholder text for 'EAN-13' field in the product layout (this is the barcode). This field is a button! When clicked it can perform a script to open a popover or window containing all barcodes that do not have a 'ProductOptionID' assigned to it.

  • How do I structure this script?
    • Click the EAN field button - this sets the 'ProductOptionID' variable globally (is this correct to do) - [$$productOptionID]
    • The script then opens the object 'Barcodes'. This is a popover button with a portal inside filtering all barcodes from the pool that do NOT have a productOptionID value in the foreign key field
    • The script must then pause whilst I manually select a barcode and set a $BarcodeID variable?
      • Or should I script it to pick a barcode at random from the pool of available barcodes (i've already set a script to give available a figure of 1 and unavailable a figure of 0)
    • Then the script must put the BarcodeID variable in the product option record
  • Is the above the right way to go about it?
  • I also need a way to un-assign a barcode from a product and therefore remove the value from the product option id field in the barcode pool

I have one more query. I have a relationship between Product Option table and the Barcode Pool. This relationship is O2M the barcodeIDpk with a lookup for the actual EAN (barcode) value on the Product Option table. When I set a barcode ID in the Product Option table - shouldn't the ProductOptionIDfk field update in the Barcode pool with the ID of the product option that the barcode is assigned to??

I am convinced I had it working earlier - but not anymore and cannot see to figure out why?

See my relationship graph below and the solution attached.

Thanks,
Luke

CRM Trial barcode.fmp12

Screen Shot 2016-02-22 at 11.51.44.png

Edited by Lee Smith
removed Q: not necessary

  • Author
  • Newbies

...anyone? :(

See if something like the attached could work for you:

 

 

AssignBarcodes.fp7

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.