Jump to content

script to create and populate new portal row


michaeldaly

This topic is 5553 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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"]

Link to comment
Share on other sites

This topic is 5553 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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