Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL (Archived)

Dynamics SL SAFGrids (unable to locate field)

Posted on by Microsoft Employee

I am curious if anyone has developed an SL screen (using the SDK toolkit) using multiple SAFGrid controls with each control referring to the same physical SQL table.

A little explanation of why I need to do this.  I need to develop a screen that presents different views of data from the same SQL table.  For example, one grid presents an open credits, the second grid presents and charges that have some sort of credit or payment applied to them and the third grid presents any changes that have an open balance.  These presentations include some additional fields that do not exist in ARDoc so the screen utilizes a working table that is populated base on some user-specified criteria in the header of the form and this table also includes these new fields needed for the process behind the screen.

I have attempted to pull this off by creating 3 alias definitions in the DH file definition for the table and then referring to those alias names in the SETADDR calls and in the field property of each SAF control in each grid cell.  I have 3 different DBNAVs defined to set the selection criteria for each SAFGrid.  The DBNAVs refer to the actual SQL table name and not the alias names.  The DETAILSETUP calls refer to the cursors established in the SETADDR and SQLCURSOREX calls.

However, when I attempt to open the screen it tells me that it cannot locate the field xxxxxx in table yyyyyy for the control form1.zzzzzz.  where xxxxxx is the actual field name in the SQL table and what is in the field property of the control and yyyyyy is the alias name for the table and zzzzzz is the control name linked to that field.

If I trap the code after the SETADDR calls and before the SCREENINIT call I can refer to the field in the immediate window and see its value so I know the SETADDR and DH files are in sync.  I can even execute the SCREENINIT call and still am fine.  I can then successfully make the DETAILSETUP calls for all 3 SAFGrids.  However, when I make the first DETAILLOAD call I get the error message.  The DETAILLOAD calls are referring to the cursors set up for the alias table names.  If I do not make the DETAILLOAD calls at the form load time (e.g., let SL control the loading of the grid controls) I get the same error.

I cannot tell if my issue is because I am using alias names for the one table or the fact that I have multiple grids referring to the same table or what.  If I take the offending field and change its property to refer the actual table name (which also has a SETADDR and such set up for it) then the field in error changes to the next control in the grid.  If I change all the SAFGrid controls to refer to the actual table name then the form no longer gives the error but the SAFGrids do not populate correctly.  What is interesting is that the SAFGrids get the expected number of rows but each field is either blank or a 0 depending on the control type.

I cannot have all 3 SAFGrids referring to the same actual SQL table name because each grid has to be at its own level and the SETADDR calls will then complains that the level has already be used in another SETADDR call.

I realize that this is a complex posting and the explanation is lengthy but more detail is typically better than less.  I have built several other screens with more than one SAFGrid control on it but those have always had each grid matched up to a single SQL table.  This is the first time I have attempted to present different views (not actual SQL views, just different DBNAVs for each grid) in separate grids.  I may be pushing SWIN beyond its limits here but I am surprised how powerful SWIM can be if you only know how to play by its rules.

*This post is locked for comments

  • CFROTON Profile Picture
    CFROTON 4,710 on at
    RE: Dynamics SL SAFGrids (unable to locate field)

    Hello Rick,

    I"ve put your question to a developer, they might know some tips ...

    Thank you,

    Jana MacDonald

  • Mark E Profile Picture
    Mark E 6,405 on at
    RE: Dynamics SL SAFGrids (unable to locate field)

    Rick, did you ever resolve this?  I am trying to build a screen with similar functionality, having 2 SAFGrids both writing records to the same SQL table.  I am able to code the screen correctly if each SAFGrid has its own level and SQL table, but not when they need to write to the same SQL table.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics SL SAFGrids (unable to locate field)

    Since no one had a response to this question and my head is black and blue from banging it against the wall trying to make this work, I changed tactics and created 3 working tables for this screen populating each with the type of data that each SAFGrid needs using 3 unique DBNAV statements with the associated stored procedures and assigning a unique level to each SAFGrid.  the Update control lists the header and the 2 grid levels each with the D attribute.  I am using DetailLoad to populate the grids but even taking those calls out does not make a difference in the problem stated below.

    The screen now displays what I want in each grid but I have a new problem.  I can edit items in the grid and save them one grid at a time closing the screen between each grid change but, if I edit items in one grid and then move to the next grid (each grid is on its own tab) the program comes up with an error that it has deleted the rows on the grid that I just left.  It does not actually delete the records but it does not save my changes.

    It appears that most SL screens that utilize the SAFGrid control do not have more than one grid control like I am trying to do but there are some screens (like employee history) that do have more than one grid control so it is my assumption that a screen can have more than one grid control and SWIM can handle it.

    Anyone have any ideas on what I am missing or doing wrong?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans