Hemen Babla Posted March 2, 2014 Posted March 2, 2014 Hello,  I being trying to run the script but cant find any help with this.  basically i am trying to perform an condition where if the available qty is less then the delivered qty, it should not proceed. but the error i am receiving is different.  the error is also seen even it i have sufficient qty in the stock.  Please find my attached script and let me know if am making any error.  Regards
LaRetta Posted March 3, 2014 Posted March 3, 2014 ... but the error i am receiving is different. the error is also seen even it i have sufficient qty in the stock. What error? I suggest that you download this demo file: http://fmforums.com/forum/topic/63425-auto-fill-one-field-with-text-from-two-fields/#entry300150. This is a properly optimised invoice structure. Is this how you are set up? We need to understand your structure (zip and attach your file ideally) and in human-speak explain exactly what you are trying to do; your script simply won't logically work and your naming does not help here. So back up a bit, provide detail and perspective and we'll help you figure it out. As an aside, it is best to use script variables (single $) instead of global variables ($$) because script variables disappear when the script ends. And you do not want global variables hanging around taking up resources (and potentially adding confusion) unless there is a purpose for them. :-)
Hemen Babla Posted March 3, 2014 Author Posted March 3, 2014 Hi Laretta, Thanks for the reply but this is what i am not looking for. I have this script which runs and check that the delivered qty should not be exceeding the available qty. The script works but sometime give me an prompt even available qty is more then the delivered qty. Regards
LaRetta Posted March 3, 2014 Posted March 3, 2014 If you cannot provide further information, I cannot assist you. Would you like to try?
comment Posted March 3, 2014 Posted March 3, 2014 Please find my attached script and let me know if am making any error. I can barely read your screen shot. Please post your script as text next time. Anyway, the error is obvious. You start by setting two variables. Then you loop over the found set, comparing these two variables over and over. The variables do not change, and the result of the comparison is the same no matter which record is the current one. I think you want to compare the actual field values (which I can't decipher).
LaRetta Posted March 3, 2014 Posted March 3, 2014 (edited) And the script means nothing to me without perspective. I would not think it necessary to loop any records just to check if a LineItem quantity is less than a Product's quantity. But then again, I could not read the script very well and I have no idea what the fields nor tables really represent (by looking at their names alone). What I mean is, why set variables with the values from the LI table and then search that same table? I do not understand the purpose at all without some sort of perspective. :-) Edited March 3, 2014 by LaRetta
Lee Smith Posted March 3, 2014 Posted March 3, 2014 Thanks for the reply but this is what i am not looking for. You show you have Advance, did you run your script using “Script Debugger”?
Hemen Babla Posted March 3, 2014 Author Posted March 3, 2014 Hi All, I have put new image of the script, but even i will write the script down. Its able product qty check script. Product Deliver QTY Available QTY P1 5 4 P2 4 10 P3 2 3 This are the line items in the delivery order. before processing the order it check if it has sufficient qty to deliver. So i do an check with the loop Setvariable ($$ID,DO_Number) gotolayout enter find mode() setfield (DO_number;$$ID) performfind() //This is only to check for that perticular do number. which has this 3 item to deliver. Loop If ( Deliver QTY>AvailableQTY) Showmessage("insufficient stock") Else Endif go to next record. end loop. IF condition somtime give me message even i have more stock which in this case is line number 2. i have found one more thing on my loop is the error/message comes if the available qty has 2 or 3 digit number. my Available qty is calculation field which is base on the location selected by the user to deduct.
comment Posted March 3, 2014 Posted March 3, 2014 Hard to say without understanding the context. Two things I would focus on: 1. Depending on the result of the comparison, the script may execute a Go to Related Record[] step in the middle of the loop. This may change the context for the rest of the loop. 2. What is the type of the Deliver QTY field and what is the result type of the Available QTY calculation field? I also notice that the field names used in the script are different from the ones you posted here. Not sure what to make of that.
Hemen Babla Posted March 4, 2014 Author Posted March 4, 2014 Hi, 1) the go to record is just to prompt the user on which product the qty is more or none. 2) Delivery qty is an number filed, and available qty is an calculation field base on which location is selected. i have uploaded an other image in my main post please check may be u will get an idea.
comment Posted March 4, 2014 Posted March 4, 2014 Why don't you post a file that shows the problem? Or even better,, try to reproduce the problem in a new file that contains nothing but what's necessary to show this issue. if you succeed, then post it here. If not, see what's different.
LaRetta Posted March 4, 2014 Posted March 4, 2014 (edited) 2) Delivery qty is an number filed, and available qty is an calculation field base on which location is selected. Which Location is selected? Is it a global field in LineItems? And is it related to Products based upon ProductID and Location? Why is available quantity a calculation in LineItems? If the product quantity is a calculation in the LineItems table instead of a value (or calculation) in the Products (or Inventory) table, and if Location entered plays a part in the value (using the Location as a relational or portal filter to Products?) then the context is critical to understand here ... it should not be required to loop but rather to simply look through the relationship. Storing or calculating the available Product quantity in LineItems is heavy-duty, probably unnecessary, and possibly incorrect. But that is why I have asked about structure and relationships. And it is also why I presented a NORMALISED file as an example; to see if we had a normalised relationship at least. I see us no closer to knowing what we need to know without this perspective. Added blue Edited March 4, 2014 by LaRetta
Fitch Posted March 7, 2014 Posted March 7, 2014 Delivery qty is an number filed, and available qty is an calculation field base on which location is selected. You haven't said if the available qty calculation has a text result type. That would explain the issue. E.g.: NUMBER 5 < TEXT 9 NUMBER 5 > TEXT 10
Recommended Posts
This topic is 3971 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