How to fill Matrix by coding
Hello all,
I'm striving to build new rule in Optimizer CScode. Talking here about SAP BusinessOne with CoreSuite add-on and SwissAddonFramework
From a provider order ( form 142) , I need to create a sales order ( Form 139) in some circumstances.
This is the actual working code :
SwissAddonFramework.UI.EventHandling.ItemEvents.FormLoadEventHandler del = null;
del = delegate (SwissAddonFramework.UI.EventHandling.ItemEvents.FormLoad ev)
{
SwissAddonFramework.UI.Components.Form.RemoveHandler(formType, SwissAddonFramework.UI.Components.ModeComponent.FormModes.ALL, del);
ev.Form.Select();
ev.Form.Mode = SwissAddonFramework.UI.Components.ModeComponent.FormModes.ADD;
((SwissAddonFramework.UI.Components.TextEdit) ev.Form.Items["16"]).Value = "Cette commande a été auto-générée à partir de la commande d`achats.";
//Here should come my Matrix code
};
SwissAddonFramework.UI.Components.Form.AddHandler_Load(formType, SwissAddonFramework.UI.Components.ModeComponent.FormModes.ALL, del);
SwissAddonFramework.UI.Components.MenuItem.GetFromUID(menuId).Activate();
I now want to add data into the Items list of the Form 139 ( sales order ), which is Item "38"
When I read data from the Item 38 ( in other programs ), I read it as a matrix. So, I thought to write into Item 38 as a matrix.
Here are the codes I've tried
// ((SwissAddonFramework.UI.Components.Grid) ev.Form.Items["38"]).SetValue("1", 1, "P404SCF043");
// ((SwissAddonFramework.UI.Components.Matrix) ev.Form.Items["38"]).SetValueWithoutValidation("1", 1, "P404SCF043");
// Matrix sortie = ((SwissAddonFramework.UI.Components.Matrix) ev.Form.Items["38"]);
// sortie.SetValue("1", 0, "P404SCF042");
// SwissAddonFramework.UI.Components.Matrix sortie = SwissAddonFramework.UI.Components.Matrix.GetFromUID(ev.Form, "38");
// sortie.SetValue("1", 1, "P404SCF040");
// ((SwissAddonFramework.UI.Components.Matrix) ev.Form.Items["38"]).SetValue("1", 1, SQLItemCode);
// Matrix sortie = SwissAddonFramework.UI.Components.Matrix.GetFromUID(ev.Form, "38");
// sortie.SetValue("1", 0, SQLItemCode);
( I set it in remark only to show cleary that it doesn't work better without remarks slashes )
Thanks for reading and support.
0
Please sign in to leave a comment.
Comments
0 comments