Normal Topic Changing subform element visibility from Parent (Read 296 times)
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Changing subform element visibility from Parent
Apr 12th, 2009 at 8:58pm
Print Post Print Post  
I want to print 3 copies of my Order form and SOLines subform, using one-click of my Print button on my Order form.  I need the programming to first toggle the subform to table view, then print 2 copies with the Price field invisible, and the third copy with the Price field visible.  The following code is a print button on the subform, which prints the sequence exactly correct.  The problem is that I need to print the Parent AND the child table form, and I cannot figure out how to have programming on the Parent print button change the Price element on the subform table view.

Question:  I've tried using FormAttribute, and it works fine while the subform is in Form mode, but it doesn't seem to work after the subform goes into tableview. 
     Can a subform element attribute be changed while the subform is in tableview?
     Or, can a subform be called via code out of tableview to form mode? (if so, then I can just repeat the first lap and have ItemPrice be visible for the 3rd print)

Any help is appreciated.

print code ....
If (@Mode() = 0) Or (@Mode() = 1)
{
  // change visibility for non essential printing fields, then switch to table mode
  // then print twice

  FormCommit("SOLines")
  FormAttribute("SOLines", "ItemCost", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "Margin", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "ItemCat", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "ItemCustPriceID", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "SONum", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "SODate", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "ClientID", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "ItemNum", ATTR_ID_VISIBILITY, "1")
  FormAttribute("SOLines", "ItemDesc", ATTR_ID_VISIBILITY, "1")
  FormAttribute("SOLines", "ItemUOM", ATTR_ID_VISIBILITY, "1")
  FormAttribute("SOLines", "ItemQty", ATTR_ID_VISIBILITY, "1")
  FormAttribute("SOLines", "ItemPrice", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "DeleteLineItem", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "NextRecord", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "NextRecord10", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "AddThisLineItem", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "CreateNewLine", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "TableView", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "Prac4", ATTR_ID_VISIBILITY, "0")

  FormViewType("SOLines", FORM_VIEW_TYPE_TABLE)
 
  vPrt = @PrintAForm(0, 1, 1, 1, 28, -1, -1, -1, -1, 1, 1)
  vPrt = @PrintAForm(0, 1, 1, 1, 28, -1, -1, -1, -1, 1, 1)

  // change attributes so that for the 3rd print the Price field is visible, then print
  // the third copy of this parent and subform record

  FormAttribute("SOLines", "ItemCost", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "Margin", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "ItemCat", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "ItemCustPriceID", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "SONum", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "SODate", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "ClientID", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "ItemNum", ATTR_ID_VISIBILITY, "1")
  FormAttribute("SOLines", "ItemDesc", ATTR_ID_VISIBILITY, "1")
  FormAttribute("SOLines", "ItemUOM", ATTR_ID_VISIBILITY, "1")
  FormAttribute("SOLines", "ItemQty", ATTR_ID_VISIBILITY, "1")
  FormAttribute("SOLines", "ItemPrice", ATTR_ID_VISIBILITY, "1")
  FormAttribute("SOLines", "DeleteLineItem", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "NextRecord", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "NextRecord10", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "AddThisLineItem", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "CreateNewLine", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "TableView", ATTR_ID_VISIBILITY, "0")
  FormAttribute("SOLines", "Prac4", ATTR_ID_VISIBILITY, "0")

  ForceRedraw()
  vPrt = @PrintAForm(0, 1, 1, 1, 28, -1, -1, -1, -1, 1, 1)
 
  formviewtype("SOLines", 0)
}
  

Larry
Back to top
IP Logged