How to show Item info
Paul Witmond
Hello,We want to show some info about an Item during order entry
We modified the BPINFOS example but it's not working
What am I doing wrong ?
Regards,
Paul
try
{
// Ophalen artikel nummer
string ItemCode = SwissAddonFramework.UI.Components.Matrix.GetFromUID(pVal.Form, "38").GetValue("1", 1);
SwissAddonFramework.Messaging.StatusBar.WriteError(ItemCode);
// Ophalen FREETEXT van Artikel
using (System.Data.SqlClient.SqlDataReader sdr = SwissAddonFramework.B1Connector.GetB1Connector().
ExecuteQuery("SELECT REPLACE(CAST(UserText AS VARCHAR(4000)),CHAR(13),CHAR(10)) FROM OITM WHERE ItemCode='" + ItemCode +"'"))
{
SwissAddonFramework.UI.Dialogs.MessageBox.Show(ItemCode, "OK");
if (sdr.Read())
{
// READ FREETEXT FROM TABLE
string freeText = sdr[0].ToString();
// IF THERE IS FREETEXT
if(!string.IsNullOrEmpty(freeText))
{
// -> SHOW MESSAGE BOX WITH FREETEXT
SwissAddonFramework.UI.Dialogs.MessageBox.Show(freeText, "OK");
}
}
}
}
catch(System.Exception exe)
{
SwissAddonFramework.Messaging.Debug.WriteMessage("Error in coresuite customize Regel: " + exe.Message, SwissAddonFramework.Messaging.Debug.DebugLevel.Exception);
SwissAddonFramework.Messaging.StatusBar.WriteError("Error in coresuite customize Regel: " + exe.Message);
}
return true;
Michael Egloff
Hello Paul,please tell us what the exact error is (is there an error message / nothing happens / the event is not catchable / etc). Otherwise it's very difficult for us to reproduce the error.
If you change
string ItemCode = Matrix.GetFromUID(pVal.Form, "38").GetValue("1", 1);to
string ItemCode = Matrix.GetFromUID(pVal.Form, "38").GetValue("1", pVal.Row-1);then the example should work.
0
Please sign in to leave a comment.
Comments
0 comments