Get current Matrix cell

MaximeDawnsMaximeDawns Member Posts: 10
Hi,
I'll try to be clear on that one. I want to get the column ID i'm currently focusing. For example, in the screenshot :
1. The user type default values in Area 1 (Red)
2. He focuses the cell he wants the default values to be typed (Area 2 in blue + Area 5 in pink)
3. When he presses enter on the cell, the line is created in Area 3 (green) with the correct "Resource No." and "Date"

Problem is, if I just type the data manually, it'll work because in the code I passed 1, 2, 3 etc... depending on which "OnAfterValidate" it is. And i want to use the button marked as 4 ("Create Line") to automatically fill the value "10" (in area 1) into the cell i'm focusing.
Is there any way to achieve it ? The only thing to have is basically the currently focused column ID (from 1 to 12 in this example).

qxbi7c04mp85.png


Thanks.

Best Answer

Answers

  • MaximeDawnsMaximeDawns Member Posts: 10
    OK i'll give it a try. But I can't actually find this assembly : Microsoft.Dynamics.Framework.UI.WinForms.Controls.BusinessGrid

    I only get this for "Microsoft.Dynamics.Framework"
    99nkrckcn6ji.png

    In the "Server" Tab wi56nni8azle.png
  • da_nealda_neal Member Posts: 76
    edited 2019-03-12
    Copy needed component from \\RoleTailored Client\ to \\RoleTailored Client\Add-ins\
  • MaximeDawnsMaximeDawns Member Posts: 10
    Alright ! All variables set now (thanks a lot for your help by the way). Now two error messages.

    First when I open the page :
    svjf66mxaf27.png

    Second, when I click the Action :
    i1wkjpla6yhl.png


    I think the error might wome from what you call "PageID" and "RepeaterID". Here's what i took :
    Page ID :
    ysckr7nx5c93.png

    And RepeaterID :
    m455iz8rzy6d.png
  • krikikriki Member, Moderator Posts: 9,115
    [Topic moved from 'NAV Tips & Tricks' forum to 'NAV Three Tier' forum]

    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • da_nealda_neal Member Posts: 76
    edited 2019-03-14
    PageID It is Object ID
    RepeaterID is ok but better make for example number = 1, it is not ok for big value (i do not know why :smile: )
    And i forgot to say that dot net variables must be declared RunOnClient=Yes.
  • MaximeDawnsMaximeDawns Member Posts: 10
    Ok so now, page is opening then closing instantly, wiht no error message :disappointed:
  • MaximeDawnsMaximeDawns Member Posts: 10
    Tried commenting and uncommenting line by line. Appears to be this line causing the issue of instant closing:
    lFormCollection := lApplication.OpenForms;
    
  • AlexDenAlexDen Member Posts: 86
    CurrForm and BusinessGrid variables should be global.
  • MaximeDawnsMaximeDawns Member Posts: 10
    edited 2019-03-13
    Alright ! I don't really get why CurrForm has to be Global but ok. It's working properly now. Thanks guys
  • da_nealda_neal Member Posts: 76
    edited 2019-03-13
    If variable is local it is destroyed after using. If variable is global it is alive until page opened.
    In dot net, variables transfers by reference, so your Currform variable it is single reference to page. And when variable cleared it is destroy own page.
  • jrm@bdo.dkjrm@bdo.dk Member Posts: 10
    Hi

    Where do you find the dll:
    Microsoft.Dynamics.Framework.UI.WinForms.Controls.BusinessGrid.DataGrid.CurrentCell.ColumnIndex
    I only have these ?
    z8gt9l5vexao.png



  • da_nealda_neal Member Posts: 76
    One level up
  • jrm@bdo.dkjrm@bdo.dk Member Posts: 10
    It aint here either...

    ly0d49pc7zak.png
  • da_nealda_neal Member Posts: 76
    Microsoft.Dynamics.Framework.UI.WinForms.Controls.BusinessGrid(dot net variable) part of
    Microsoft.Dynamics.Framework.UI.WinForms.Controls.dll
  • jrm@bdo.dkjrm@bdo.dk Member Posts: 10
    Still no luck - I can not get deeper into the: Microsoft.Dynamics.Framework.UI.WinForms.Controls.BusinessGrid...

    Do you make this in AL or C/AL
    When I registrate the
    Microsoft.Dynamics.Framework.UI.WinForms.Controls.BusinessGrid in my Variables I do not get any triggers in the page??
  • jrm@bdo.dkjrm@bdo.dk Member Posts: 10
    Sorry - Forgot to enable triggers :blush:
  • jrm@bdo.dkjrm@bdo.dk Member Posts: 10
    sorry to ask again - but I can not find these 2 in the DotNet system...

    //String System.String
    //ArrayControls System.Array
  • da_nealda_neal Member Posts: 76
    Google can help you bro :)
  • jrm@bdo.dkjrm@bdo.dk Member Posts: 10
    Hi
    It is mostly working now - but I get this message - it seems like the pageReady code dont are executed - when should that be run?
    z7inc4bc7t77.png
  • drotunnodrotunno Member Posts: 3
    edited 2020-10-21
    Hi all, I have the error
    4a2i1fv17jd9.png
    clicking on action.

    The code in the AddinReady trigger do not start. I add the add-in in the property of cell of matrix. Is that correct?
    Can you help me?
    Thanks

    Edit:
    Resolved adding new field without source so that the event is now triggered.
Sign In or Register to comment.