Matrix forms

I’ve a problem. I want a matrix to display one of two fields, i.e. either field1 or field2, based on a user selection on the form. Both fields comes from the same table. Any suggestions? I tried to put another matrixbox to the form and then use VISIBLE and NOT VISIBLE, but was told that “The form does not recognize the control x”, where x is the control id of the new matrixbox. Best regards, Erik P. Ernst, webmaster Navision Online User Group

Erik, Did a few trials (not too extensive, though). It looks like you may have only one matrix source on the form. You may copy matrix 1 and 1 & 2 will run in parallel (no complaints on double naming?!) As long as you keep the table relations of the 2nd matrix pointing to those of the first matrix, you can have two matrix boxes at the same time (even with different fields!). When you change one of the tablerelations in the second box, you get the “… not recognize control x” message. Conclusion: Only one matrix box on a form allowed. Possible solution: Use subforms. John

Erik Could you not use a Variable as a Source for the Matrix Field And Conditionaly code the Value ? Mr David Cox MindSource (UK) Limited Navision Solutions Partner Email: david@mindsource.co.uk Web: www.mindsource.co.uk

Tried that already. It seams like it goes into a cicle, when doing that. Best regards, Erik P. Ernst, webmaster Navision Online User Group

Erik Tested it here on Cronus and it worked OK Form 221 Resource allocation per Job I created two Globals DataType Subtype Length OutputQty Decimal GroupOut Boolean Changed the Matrix Field Source to OutputQty Added a Check Box to the form Source:=GroupOut with C/AL Code OnAfterValidate CurrForm.UPDATE; Changed the MatrixBox C/AL Code OnAfterGetRecord() SetDateFilter; CALCFIELDS(“Budgeted Res. Qty.”,“Budgeted Res. Gr. Qty.”); IF GroupOut THEN OutputQty:=“Budgeted Res. Gr. Qty.” ELSE OutputQty:=“Budgeted Res. Qty.”; then veiw by month for 2001 when you Check the box the values are updated for all lines You will of course have to code for Assist Edit based on GroupOut for the drilldown table Mr David Cox MindSource (UK) Limited Navision Solutions Partner Email: david@mindsource.co.uk Web: www.mindsource.co.uk Edited by - David Cox on 7/27/00 9:15:34 AM

Ok. I try it again. Best regards, Erik P. Ernst, webmaster Navision Online User Group

There seems to be the same type of problem with command bottons on matrix forms. I want to hide/show bottons on a matrix form. When using ‘CurrForm.BottonName.VISIBLE(false)’ in the ‘OnOpenForm’ trigger on the form I get the same error message: “The form does not recognize the control x”, where x is the control id of the command botton.

Quote: I want to hide/show bottons on a matrix form. The Form is Not Painted yet OnOpenForm so you cannot hide the buttons. Try a function called from on AfterGetRecord(); SetButtons; SetButtons() CurrForm.ButtonName1.VISIBLE(false); CurrForm.ButtonName2.VISIBLE(“No.”<>’’); CurrForm.ButtonName3.VISIBLE("Amount (LCY)<>0); CurrForm.ButtonName4.VISIBLE(NOT Blocked); You may need a CurrForm.UPDATE(FALSE); The FALSE will update the Form without saving the Record Mr David Cox MindSource (UK) Limited Navision Solutions Partner Email: david@mindsource.co.uk Web: www.mindsource.co.uk Edited by - David Cox on 8/5/00 11:58:55 PM Edited by - David Cox on 8/6/00 12:06:46 PM

Yes well i added a text box to a form containing a matrix control, changed them name property of the text box to XXX and then made an option button which in the OnPush trigger has the code currform.xxx.editable:=false. This compiles fine, but when i try to open the form i get the “The form does not recognize the control x” the number in “control x” refering to text box XXX. Any ideas.

Allan I could not reproduce your problem, I tested it with the G/L Budget Matrix form with both an Option Control and a Command Button! I have had this problem before with other forms in version 2.01, Navision had references to controls on the form that had been renamed or deleted, I resolved it by tabbing to find the control removing the control from the form saving the object then added the control again, saving then renaming the control and adding the code. Mr David Cox MindSource (UK) Limited Navision Solutions Partner Email: david@mindsource.co.uk Web: www.mindsource.co.uk

I create 2 identical forms, “testform1” and “testform2”. On each form i have one button and one matrix-control. Testform1 looks like this: OBJECT Form 55200 Test form 1 { OBJECT-PROPERTIES { Date=08/07/00; Time=[ 8:18:32 AM]; Modified=Yes; Version List=; } PROPERTIES { Width=14630; Height=8000; SourceTable=Table15; OnOpenForm=BEGIN CurrForm.Mybutton.VISIBLE:=FALSE; END; } CONTROLS { { 1 ;MatrixBox ;1100 ;1540 ;10890;5830 ;Name=matrix; MatrixSourceTable=Table11 } { 4 ;TextBox ;715 ;2200 ;1650 ;440 ;ParentControl=1; InColumn=Yes; SourceExpr=“No.” } { 5 ;Label ;0 ;0 ;0 ;0 ;ParentControl=4; InColumnHeading=Yes } { 6 ;TextBox ;662 ;2200 ;2200 ;440 ;ParentControl=1; InColumn=Yes; SourceExpr=Balance } { 7 ;Label ;0 ;0 ;0 ;0 ;ParentControl=6; InColumnHeading=Yes } { 2 ;TextBox ;9570 ;3960 ;5390 ;440 ;ParentControl=1; InMatrix=Yes; SourceExpr=Balance } { 3 ;TextBox ;11000;1650 ;1650 ;440 ;ParentControl=2; InMatrixHeading=Yes; SourceExpr=CurrForm.matrix.MatrixRec.Code } { 8 ;CommandButton;1210 ;440 ;2640 ;660 ;Name=Mybutton } } CODE { BEGIN END. } } Testform2 look like this: OBJECT Form 55201 Test form 2 { OBJECT-PROPERTIES { Date=08/07/00; Time=[ 8:28:42 AM]; Modified=Yes; Version List=; } PROPERTIES { Width=14630; Height=8000; SourceTable=Table15; OnOpenForm=BEGIN CurrForm.Mybutton.VISIBLE:=FALSE; END; } CONTROLS { { 1 ;CommandButton;1210 ;550 ;2310 ;660 ;Name=Mybutton } { 2 ;MatrixBox ;2750 ;2200 ;10010;5390 ;Name=matrix; MatrixSourceTable=Table11 } { 5 ;TextBox ;476 ;2860 ;1650 ;440 ;ParentControl=2; InColumn=Yes; SourceExpr=“No.” } { 6 ;Label ;0 ;0 ;0 ;0 ;ParentControl=5; InColumnHeading=Yes } { 7 ;TextBox ;0 ;3410 ;2200 ;440 ;ParentControl=2; InColumn=Yes; SourceExpr=Balance } { 8 ;Label ;0 ;0 ;0 ;0 ;ParentControl=7; InColumnHeading=Yes } { 3 ;TextBox ;9240 ;3960 ;4510 ;440 ;ParentControl=2; InMatrix=Yes; SourceExpr=Balance } { 4 ;TextBox ;11110;2420 ;1650 ;440 ;ParentControl=3; InMatrixHeading=Yes; SourceExpr=CurrForm.matrix.MatrixRec.Code } } CODE { BEGIN END. } } Hope the export isn’t to messy. On testform1 i applied the matrix-control to the form first, and then the mybutton-control. In the OnOpenForm-trigger i want to hide the Mybutton-control when the form is run so i use currform.mybutton.visible:=false here. When run the form gives the well known: The form does not recognize the control 8 On testform2 i applied the mybutton-control first and then the matrix-control and now everything works fine and the button is hidden. Strange isn’t it. Look’s like the order by which otherwise independant controls are created matters. I have the same problem whether i use Fin 2.01 W1 or Fin 2.6 DK Regards

Allan I did not think you could hide a control on open form! I prefer to hide Controls with the OnAfterGetRecord trigger then the Controls are record specific. Mr David Cox MindSource (UK) Limited Navision Solutions Partner Email: david@mindsource.co.uk Web: www.mindsource.co.uk Edited by - David Cox on 8/7/00 12:13:19 PM Edited by - David Cox on 8/7/00 12:13:42 PM