Add tab to PO20 detail/tab area

Sort:
You are not authorized to post a reply.
Author
Messages
ShawnV
Advanced Member
Posts: 37
Advanced Member

    I am trying to add a new tab to the PO20 detail/tab area using Lawson Smart Office scripting.  Currently the PO20 screen has 6 tabs in the detail area.  I want to add a 7th tab to which I want to add additional data elements.

    Unfortunately I cannot get the scripting to work to either get the tab page container or add a new tab page.  Below is a brief snippet of the scripting code I have.  Each of the console.WriteLine values are coming back as undefined.

    var aa = form.GetTabPageContainer("TF0-0");
    console.WriteLine("GetTabPageContainer: " + aa);

    var bb = form.AddTabPage("TR0""TF0-6""NewTab""");
    console.WriteLine("AddTabPage: " + bb);

    I am assuming the issue is that the PO20 screen has a FormGrid which contains a Detail Area which contains a Tab Area.

    Any advice is appreciated.

    Thank you.

    Shawn Van Sluys

     

    Vince
    Veteran Member
    Posts: 37
    Veteran Member
      There currently is no direct support for adding a tab in a detail area. However, with a lot of brute force (code) it is possible.

      Below is a partial snippet that would add a tab to each row, however, the tabGrid would have to be initialized with the number of rows and columns, and depending on whether adding custom fields or labels, or moving existing details fields to the new tab, it may require a lot a code to move data in and out of the transaction. New custom fields should be named such that they end with "r" + zero-based row number.
      
      		for (var idx = 0; idx < 5; idx++)
      		{
      			var tabGrid = form.AddTabPage("TR0_"+idx, "TF0_6_"+idx, "Test", null);
      			InitializeGrid(tabGrid);		// not shown
      			var label = ControlsUtil.AddCustomLabel(form, tabGrid, "labelr"+idx, 0, 0, 20, "Label content");		}
       
      Vince
      Veteran Member
      Posts: 37
      Veteran Member
        I have to correct a statement in that last post - the tabGrid has already been initialized with the number of rows and columns available on the tab.
        Vince
        Veteran Member
        Posts: 37
        Veteran Member
          I will add an enhancement in a future release to support this (JT-801464): ControlsUtil.AddDetailTabPage
          ShawnV
          Advanced Member
          Posts: 37
          Advanced Member
            Vince - Thank you so much for the help. I was able to add the new tab by following your code provided. Also thank you for adding an enhancement request.
            You are not authorized to post a reply.