Fred in Thailand Posted July 26, 2007 Posted July 26, 2007 Hi, I have a layout used to enter products in a invoice table. I have put a portal on the layout that lista all the products that we sell. (Not to many) I have put a button on the portal rows that when clicked it will insert the product key into a repition field as if it was selected from a dropdown list in that field. I think that it is a Case step but can't get the syntax correct. Basicly it needs to do the following: 1) Click the product button 2) Insert the Product id into the first available empty repetition field (1 through 10) 3) the rest of the fields(name, description, price) auto enter through relationship. The reason it needs to be this way is because a dropdown list is too complicated for the salesperson to figure out. (Needs to be idiotproof) All ideas greatly appreciated.
JesseSFR Posted July 26, 2007 Posted July 26, 2007 Is there any reason specifically that you are using the field repetition field??? If you really need it, write a script that does somthing along the lines of: $counter = 1 loop if( isempty(myfield[repetition: $counter]) ) set field [ myfield[repeitions: $counter ; Product::ID ] end if exit loop if[ isempty(myfield[repetition: $counter] or $counter = 10) $counter = $counter + 1 end Loop
Fred in Thailand Posted July 26, 2007 Author Posted July 26, 2007 Thanks for the reply. Still having a little trouble. New to scripting $counter = 1I assume this is a set variable step? loop if( isempty(myfield[repetitio n: $counter]) ) I can put the rep number in but what is $Counter, Scriptmaker doesn't let me enter that. set field [ myfield[repeitions: $counter ; Product::ID ] Same Problem end if exit loop if[ isempty(myfield[repetitio n: $counter] or $counter = 10) $counter = $counter + 1end Loop This is my first use of the loop step. As I said new to all this. Still having problems with syntax. Thanks
Genx Posted July 26, 2007 Posted July 26, 2007 Hmm, in script maker words: Set Variable[$counter ; Value: 1] Loop If[ IsEmpty(myfield[$counter]) ] Set Field [myfield ; Product::ID ] /* NOTE: When you choose this script step, you will have to first specify myField, down the bottom you will see a little blank space labeled repetition - set it to $counter. */ End If Exit Loop If[ IsEmpty(myfield[$counter]) or $counter = 10)] Set Variable[ $counter ; Value: $counter + 1] End Loop HTH
Genx Posted July 26, 2007 Posted July 26, 2007 Succinct is my moddle name... well not really, its actually something kind of dodgey. You know, its so much easier to hand write the code than it is to construct the script with ScriptMaker. I wish FM would let us do it if we wanted... oh well.
Genx Posted July 26, 2007 Posted July 26, 2007 (edited) Possibly - I just blindly translated the script without actually reading anything... But from what I can gather, the script is designed to loop through the repetitions (to achieve what I'll leave Geoff or Jesse to explain - which one of you is it that hangs out around here more anyway... if it's both of you, I'm just gonna call you Geosse from now on ) Edit: But no, after reading the op's post, I don't think a Go To Next is required here -- its just meant to fill the next available empty rep. Edited July 26, 2007 by Guest
Recommended Posts
This topic is 6331 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 accountSign in
Already have an account? Sign in here.
Sign In Now