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.

script to create and populate new portal row

Featured Replies

I'm really sorry about this... It's probably the most basic question ever asked but I'm really struggling to achieve the following:

I have an invoice table and the layout contains a portal in which I create records in my line table. I'd be grateful if someone could tell me what script to use in order automatically to complete the next portal row (so create another line) if a specified field in the current row contains a specified word.

To explain; we sell shoes. The portal includes the fields "make" "style" "dye_or_taken" and "price". The "dye_or_taken" field is a drop-down list including "dye". If "dye" is selected in the current line, I want to automatically generate the next line and insert "dyeing service" in the "style" field and "20" in the price field.

Any help most gratefully received.

This isn't typical. Usually, you'd have a parts or inventory table. Then, when you enter the part or inventory number, the fields for Price, Make, Style, etc., would lookup from the inventory table into the line items table. You wouldn't skip lines in the line items table.

  • Author

Many thanks for your response. I do have an inventory table (I call it "stock") in which one of the "styles" is "dyeing service". I want to show the shoes as an item sold on one line, then the dyeing service as a separate item (or "style") on the next line. Naturally, this would be easily and quickly carried out manually but I thought it would be neat if it could be entered automatically with a script.

If you have any further thoughts, they'd be welcome.

Well, you're really selling two things, the shoes (line item#1) and the dyeing service (line item#2).

You could script adding two line items and assign the script to a button. However, that would enter a specific stock# for each line item.

  • Author

Aha - that would be perfect. I'd really appreciate it if you could tell me the steps of a script that would do that, as I'm really struggling to get anywhere with it.

Thanks again

Here's an Invoice Demo. It shows not only how to add two line items to an invoice via a button, but some basic "how to" build an invoice. I used the Anchor-Buoy method in the Relationship Graph (my preferred method), zz_fields that I always put in every table, and my standard field naming conventions.

Hope this helps get you started.

InvoiceDemo.fp7.zip

  • Author

Well, that's very kind of you to take the trouble to do that - it's a great help.

Best regards and thanks again,

Michael

Since you have FileMaker 10 you can use a script trigger for this and skip the extra click.

  • Author

Yes, that's what I thought but, being a complete beginner, I couldn't put together a script that did the job! I tried to write it so that, if "dye" was selected on one line, it generated the next line with "dyeing service" in the "style" field.

I had a script trigger on modification of the field "dye_or_taken" and after hours of tinkering with it my best effort at a script was:

If [line::taken_dye = "Dye]

Go to Portal Row [select; Next]

Set Field [line::style["Dye Service"]]

End If

If you can point out my error(s) I'd be only too pleased. If not, I'll play around with the demo kindly donated above.

Thank you

The set field line looks weird. I think you have have put "Dye Service" where you specify a field's Repetition.

Go back into the script and click the Set Field step. Notice that there are two Specify buttons.

Click the first button, select the field, and set the Repetition to 1 (normally you just leave that alone). Click OK.

Click the lower button, and type your text there (in quotes). Click OK.

Your script line should now look like this:

Set Field [line::style; "Dye Service"]

  • Author

Yes! Fantastic. Thank you so much. I know it was such a simple thing but I really searched and couldn't find it explained in basic steps anywhere. You saved me!

Create an account or sign in to comment

Important Information

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

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.