web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Missing data in dex table buffer

(0) ShareShare
ReportReport
Posted on by

I am having trouble figuring out what is causing this, but I have a custom form that is populated from a custom dexterity table. If I query the table I can see that the data in the table is populated for all fields. Yet If I look at the table buffer from my scrolling window in the form one field, the item number appears blank.

Tabledatafromsql.PNG

You can see the ItemNmbr from SQL above but it is missing in the buffer below

TableBufferDataPNG.PNG

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Almas Mahfooz Profile Picture
    11,009 User Group Leader on at

    May I know the primary key of your table and the piece of code you are reading data with?

  • Community Member Profile Picture
    on at

    Sure:  Here is the  Primary Key:

    ItemFill.PNG

    And here is the code to fill the scrolling window.

    ItemFill.PNG

    The interesting thing is that the record is brought into the buffer as shown above, with one field blank that is populated in the sql table.

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,095 Most Valuable Professional on at

    Hi Erick

    Just a couple of points.

    It is faster to use an indexed range for this especially as it is your table and your can define the index. This will use the zDP sprocs and be faster than using a range where. Range where should only be used when it is not possible to use an indexed range or if you need extra restrictions in conjunction with an indexed range.

    range clear table RMCCS_ProfileItems;

    clear table RMCCS_ProfileItems;

    'RMC_CustomerProfileID' of table RMCCS_ProfileItems = 'RMC_CustomerProfileID';

    range start table RMCCS_ProfileItems by number 1;

    fill table RMCCS_ProfileItems;

    'RMC_CustomerProfileID' of table RMCCS_ProfileItems = 'RMC_CustomerProfileID';

    range end table RMCCS_ProfileItems by number 1;

    fill window rmccsProfileItems;

    The other point is that you must leave the range in place after fill the window so that when you move around the scrolling window the contents of the window are still limited to the window.

    The screenshot of the table buffer you included, when was it taken, where is your breakpoint? Was it on the reading of the data or the saving of the data?

    Thanks

    David

  • Community Member Profile Picture
    on at

    The break point was after on the fill event of the window so that it stopped after the first record and I could see the contents. Thanks for these other tips.

  • Community Member Profile Picture
    on at

    David,

    I copied your logic and it gave me the same results. This time I did it with no breakpoint, but checking the table buffer after the fill. I moved up the records to the first one with data and updated the field sin the Table Buffer window to show me what was in there. I got the same results as pictured above and the data when viewed through SQL shows the same content as above as well.

  • Community Member Profile Picture
    on at

    Ok I figured out the mystery.

    On the form the Item Number is brought in  from the profile items table shown above. This is populated into a combo box which the user can use to select a different item when they are working on the form. There is an item description which come from the GP Item Master table using the  item number in the combo box.

    To reuse the logic we decided to call the item number change script after our fill of the item number, thinking it would save us from copying the logic to get the description in the fill event script for the window.

    One thing the change script does is right back the item number to the profile items table to save changes the user makes.

    Apparently the item number combo box is not recorded until the fill event trigger finishes, because when the change script is executed from the fill script, the field is empty in the change script and it copies back the empty field to the profile items table which is why I saw what I saw.

    What I have to do then is copy the logic I need from the change script into the fill script. I know a stored procedure would be a way of reusing the code, but the logic is not complex enough for a stored procedure, I don't think.

    Being new to GP I'm not sure what the common practice would be. Is it more the case that redundant code is always placed in stored procedures or does it depend more on the complexity of the code?

  • Verified answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,095 Most Valuable Professional on at

    Stored Procedures refer to SQL procedures which can be called with the call sproc command.

    I think you are referring to Dexterity Procedures and Functions which can be global or form level.

    It is very common to have subtly different code to display the description for the change and fill/display events.

    What you can do is populate the Item Number on the window and then use run script on the Item Description field from both your change and fill scripts. Then place the script to retrieve and display the description in the change script of the Item Description field.

    That is similar to the procedure approach, because it re-uses code. But it does use parameters which can provide a layer of abstraction.

    As long as it works.

    David

    PS: If you attend Dexterity training we take your through some examples which will help you troubleshoot and understand issues like this.  I am running training in the week before GPUG Summit.

    winthropdc.wordpress.com/.../announcing-dexterity-training-at-gpug-summit-2017-in-nashville-tn-usa

  • MG-16101311-0 Profile Picture
    26,225 on at

    I love my friend David Musgrave to death, but his answer above is not entirely accurate. When using a range where statement, the burden is placed on the SQL Server Query Optimizer to use the index that will give the best performance, before it (the Optimizer) resorts to a table scan. This approach isn't any faster or slower than using an actual indexed range and maybe necessary (and preferable) when you don't have an index that totally satisfies your range criteria. 

    Dexterity also allows you to set a virtual key on a table using the assign as key statement. The only thing to consider here is that assign will not sort the data in the desired order because there isn't an actual key. Again, the SQL Server Query Optimizer plays a major role here as it needs to determine the best index out of the available ones that best matches the "virtual" indexed range.

  • MG-16101311-0 Profile Picture
    26,225 on at

    Your script above should read something like this:

    range clear table RMCCS_ProfileItems;
    
    range table RMCCS_ProfileItems where physicalname(RMC_CustomerProfileID of table RMCCS_ProfileItems) + CH_SPACE + CH_EQUAL + CH_SPACE + SQL_FormatStrings(string(RMC_CustomerProfileID));
    
    fill window rmccsProfileItems;


    I am also under the assumption that you RMC_CustomerProfileID field is a non-string value (?), i.e., integer. Otherwise, there's no need to cast it to string, hence that line would read something like:

    range table RMCCS_ProfileItems where physicalname(RMC_CustomerProfileID of table RMCCS_ProfileItems) + CH_SPACE + CH_EQUAL + CH_SPACE +SQL_FormatStrings(RMC_CustomerProfileID);


  • Almas Mahfooz Profile Picture
    11,009 User Group Leader on at

    Mariano,

    Virtual keys do allow sorting in ascending and descending order, I have used it so many times.

    assign virtual_key2 as key for table ES_Item_Detail_Temp with
    	KEY_OPTION_ALLOW_DUPLICATES using 'User ID' of table ES_Item_Detail_Temp,
    	Condition_Name of table ES_Item_Detail_Temp with KEY_SEGMENT_OPTION_DESCENDING;
    	
    	range clear table ES_Item_Detail_Temp;
    	range table ES_Item_Detail_Temp where physicalname('User ID' of table ES_Item_Detail_Temp)+"='"+'User ID' of globals+"'";
    	
    	fill window ES_View_Item_Detail_Scroll of form ES_InventoryItemList table ES_Item_Detail_Temp by number virtual_key2;


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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
mtabor Profile Picture

mtabor 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans