Help with Edit

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
[email protected]
Posts: 278
Joined: Tue Aug 05, 2008 3:16 pm

Help with Edit

Post by [email protected] »

I have a rule in a object that says the following:

If COUNT Product WHERE (Product.Part_Number=ThisProduct.Part_Number AND Product.Application_Mode='NewVersion')<1 Then
Create Product WITH Product.Description_Long=ThisProduct.Description_Long,Product.Description_Short=ThisProduct.Description_Short,Product.x_extItems=ThisProduct.x_extItems,Product.Lead_Time_Default=ThisProduct.Lead_Time_Default,Product.List_Price=ThisProduct.List_Price,Product.Model_Number=ThisProduct.Model_Number,Product.Part_Number=ThisProduct.Part_Number,Product.Remark_History=ThisProduct.Remark_History,Product.Support_Person=ThisProduct.Support_Person,Product.X_Attachment=ThisProduct.X_Attachment,Product.X_Company_Supplier=ThisProduct.X_Company_Supplier,Product.X_Export_Item_Product=ThisProduct.X_Export_Item_Product,Product.X_Ref_Product_Family=ThisProduct.X_Ref_Product_Family,Product.X_Alert_Notification=ThisProduct.X_Alert_Notification,Product.Application_Mode='NewVersion',Product.Revision=ThisProduct.Revision+1

Pretty straight forward. I want to Edit the newly created Product. What do I need to do? Everytime I try to use some form of editing I always get the original Product versus the new Product. I am sure there must be a simple way to edit the new Product.
technopak
Posts: 287
Joined: Thu Dec 04, 2008 2:16 pm

Post by technopak »

Mmmm very odd,

You should only have to EDIT Product after the CREATE statement for it to work.

CREATE puts the Product in context, so EDIT should work.


Peter
BobK
Posts: 545
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Post by BobK »

Have you tried using 'That' prefix?
For example: Edit ThatProduct


From the Users Guide:
That prefix indicates the second instance of an object added to the Context. Usually it is
the instance found by the FIND or PICK FROM action or created by the CREATE or
ENTER NEW actions.
Bob
rocketman
Posts: 1252
Joined: Fri Jan 02, 2009 11:22 pm
Location: Preston UK
Contact:

Post by rocketman »

Is there some reason why you can't use ENTER NEW


If COUNT Product WHERE (Product.Part_Number=ThisProduct.Part_Number AND Product.Application_Mode='NewVersion')<1 Then
ENTER NEW Product WITH Product.Description_Long=ThisProduct.Description_Long,Product.Description_Short=ThisProduct.Description_Short,Product.x_extItems=ThisProduct.x_extItems,Product.Lead_Time_Default=ThisProduct.Lead_Time_Default,Product.List_Price=ThisProduct.List_Price,Product.Model_Number=ThisProduct.Model_Number,Product.Part_Number=ThisProduct.Part_Number,Product.Remark_History=ThisProduct.Remark_History,Product.Support_Person=ThisProduct.Support_Person,Product.X_Attachment=ThisProduct.X_Attachment,Product.X_Company_Supplier=ThisProduct.X_Company_Supplier,Product.X_Export_Item_Product=ThisProduct.X_Export_Item_Product,Product.X_Ref_Product_Family=ThisProduct.X_Ref_Product_Family,Product.X_Alert_Notification=ThisProduct.X_Alert_Notification,Product.Application_Mode='NewVersion',Product.Revision=ThisProduct.Revision+1
Rocketman

V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
rocketman
Posts: 1252
Joined: Fri Jan 02, 2009 11:22 pm
Location: Preston UK
Contact:

Post by rocketman »

..... PS, BobK is right, if you do use create then edit, then THAT would be the prefix you'd need, but just swapping CREATE for ENTER NEW in your original code should work i would have thought
Rocketman

V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
Post Reply