Execute Query from function button
Geert Van Vooren
Probably an easy question, but I am new with Coresuite Customize.I've made a query (eg. ABC) and I would like to start it from the function button on the article-screen form (150).
What is the easiest way to do this?
Paolo Manfrin
Hi Geert,I assume you want to display the result of the query when you press the Function button right?
You need to create the Function Button rule which create a form and display the results in a grid for example.
Something like:
try {
Form form = Form.CreateNewForm("CUS_1", SwissAddonFramework.Utils.UniqueStringGenerator.Next());
form.Height = 350; form.Width = 350; form.Top = 300; form.Left = 300;
Grid g = Grid.CreateNew("G1");
g.SetSizeAndPosition(5, 5, 300, 250);
Button b = Button.CreateNew("B1");
b.Value = "Close";
b.SetPosition(g); b.Top += g.Height;
form.AddItem(g);
form.AddItem(b);
form.Load();
g.ExecuteQuery(@"SELECT ItemCode, ItemName FROM OITM");
g.Columns["ItemCode"].Editable = true;
g.Columns["ItemName"].Editable = false;
((TextEditGridColumn)g.Columns["ItemCode"].SpecificGridColumn).LinkObjectType = "4";
}
catch (Exception ex)
{
StatusBar.WriteError(ex.Message);
}
If this is not the expected result please provide a more specific question.
Kind Regards,
paolo
0
Please sign in to leave a comment.
Comments
0 comments