Newbies paszti Posted February 25, 2013 Newbies Posted February 25, 2013 I am a beginner for scripting and I like to do a multiple if statement script like: if "this=x" and "this=y" then "result=z" please find the attached picture of my script. I tryed to do that but it isn't working. Maybe only missed some ( [ ] ) mark or something? Could somebody fix my code or suggest a different solution? Thank you GaborÂ
Kris M Posted February 25, 2013 Posted February 25, 2013 Nowhere in your script do you set a value for the local variable $quantity
jbante Posted February 25, 2013 Posted February 25, 2013 In addition to $quantity not being defined, why are the last two Else If conditions separate, since they both do exactly the same thing?
MartieH Posted February 25, 2013 Posted February 25, 2013 I think you are trying to say --- If X is true AND Y is true do something but if ONLY X is true then do something else: If X is true and Y is true; do something; Else if X is true and Y is not true; do something else; This (the Y being not true) could be as simple as the status field NOT equal to whatever it is equal to in the first statement. hth, Martie
Newbies paszti Posted February 25, 2013 Author Newbies Posted February 25, 2013 Hi thanks for the answers. Sorry I forget to remove the last line. It is a script when I push a "Commit from invetory" button in an invoice then it removes the quantities from the related product stock, then locks the line items on the invoice (I can't modify after this) When I push the "Revert Inventory" button then change everything back. This works perfectly but I like to extend this script to the replacement extension. I mean if the invoice status is replacement then when I push the "Commit from inventory"button then add the quantites to the Ammount_Faulty field on the related product as well. The main thing is the first line. That formula doesn't work, I don't know the right way, because I am not a programer. How can I define like  If Get (ScriptParameter) = "commit" and T12_INVOICES::Status="Replacement"  Sorry for my language I hope somebody understand what am I want. Tanks Gabor Â
Newbies paszti Posted February 25, 2013 Author Newbies Posted February 25, 2013 Sorry, this is only part of the full script. MartieH yes you right. But my formula on the first attachment doesn't work. Maybe I missed semicolons ( or brackets. Could you please help?
Kris M Posted February 27, 2013 Posted February 27, 2013 Hi thanks for the answers. Sorry I forget to remove the last line. It is a script when I push a "Commit from invetory" button in an invoice then it removes the quantities from the related product stock, then locks the line items on the invoice (I can't modify after this) When I push the "Revert Inventory" button then change everything back. This works perfectly but I like to extend this script to the replacement extension. I mean if the invoice status is replacement then when I push the "Commit from inventory"button then add the quantites to the Ammount_Faulty field on the related product as well. The main thing is the first line. That formula doesn't work, I don't know the right way, because I am not a programer. How can I define like  If Get (ScriptParameter) = "commit" and T12_INVOICES::Status="Replacement"  Sorry for my language I hope somebody understand what am I want. Tanks Gabor  Does your commit button send in the script parameter?
Recommended Posts
This topic is 4679 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