Solved

Clear the Data View in Graph

  • 24 October 2023
  • 10 replies
  • 148 views

Userlevel 3
Badge

Hi All,

Need to clear the data view in the graph in the beginning. Currently following view returns data from the table. But I need to remove coming data from the view and show the grid empty(As per attached image).

public SelectFrom<HMRCVendorRegisterDetail>.View VendorRegisterDetail_X;

Can someone help me out?

Thanks

icon

Best answer by vardan22 25 October 2023, 15:57

View original

10 replies

Badge +11

You could use a data view delegate and simply return an empty collection:

public SelectFrom<HMRCVendorRegisterDetail>.View VendorRegisterDetail_X;



public IEnumerable vendorRegisterDetail_X()
{
    var result = new List<HMRCVendorRegisterDetail>();

    return result;
}

 

Userlevel 3
Badge

You could use a data view delegate and simply return an empty collection:

public SelectFrom<HMRCVendorRegisterDetail>.View VendorRegisterDetail_X;



public IEnumerable vendorRegisterDetail_X()
{
    var result = new List<HMRCVendorRegisterDetail>();

    return result;
}

 

Hi @darylbowman ,

I tried this one too. But the problem is VendorRegisterDetail cache contains two instered cache objects. But in my grid contains only one record at this time. How to remove that unwanted object. I tried following in RowPersisting event but no luck. Please check the screen shots which I’ve provided.

HMRCVendorRegisterDetail row = e.Row;
            if (row != null)
            {               

                if (row.BAccountID == null)
                {                    
                    VendorRegisterDetail.Cache.Remove(row);
                    e.Cancel = true;
                    return;
                }

           }

Thanks

Userlevel 3
Badge

You could use a data view delegate and simply return an empty collection:

public SelectFrom<HMRCVendorRegisterDetail>.View VendorRegisterDetail_X;



public IEnumerable vendorRegisterDetail_X()
{
    var result = new List<HMRCVendorRegisterDetail>();

    return result;
}

 

Hi @darylbowman ,

I tried this one too. But the problem is VendorRegisterDetail cache contains two instered cache objects. But in my grid contains only one record at this time. How to remove that unwanted object. I tried following in RowPersisting event but no luck. Please check the screen shots which I’ve provided.

HMRCVendorRegisterDetail row = e.Row;
            if (row != null)
            {               

                if (row.BAccountID == null)
                {                    
                    VendorRegisterDetail.Cache.Remove(row);
                    e.Cancel = true;
                    return;
                }

           }

 

Thanks

Userlevel 4
Badge

What about adding a field to the DAC/Table that is a flag for whether it is an existing record or not and then have a where clause on the Select to exclude those records. Then somewhere in the process prior to save set that same flag so that it wont show up again later when queried?

 

This feels like it would be unnecessary, but might help you avoid doing too much Cache manipulation.

Userlevel 7
Badge +5

You said that you have two records in your cache but you only want one of them displayed. What’s the criteria for that and can you include that criteria in the view?

Or do you have to review each record by a more complicated criteria logic than a view could handle?

Userlevel 7
Badge +10

Hi @bhagyat25,

Could you please try below code to display an empty grid.

VendorRegisterDetail_X.Cache.Clear();

Hope, it helps!

Regards,

Sweta

Userlevel 4
Badge +1

Hi All,

Need to clear the data view in the graph in the beginning. Currently following view returns data from the table. But I need to remove coming data from the view and show the grid empty(As per attached image).

public SelectFrom<HMRCVendorRegisterDetail>.View VendorRegisterDetail_X;

Can someone help me out?

Thanks

When do you expect to display the data in the grid?
What data should it display?

Userlevel 3
Badge

Hi All,

Need to clear the data view in the graph in the beginning. Currently following view returns data from the table. But I need to remove coming data from the view and show the grid empty(As per attached image).

public SelectFrom<HMRCVendorRegisterDetail>.View VendorRegisterDetail_X;

Can someone help me out?

Thanks

When do you expect to display the data in the grid?
What data should it display?

Hi @vardan22 

After adding new record button then verify the particular record(s) using verify vendor button click event and do the save. 

Userlevel 3
Badge

Hi @bhagyat25,

Could you please try below code to display an empty grid.

VendorRegisterDetail_X.Cache.Clear();

Hope, it helps!

Regards,

Sweta

Hi @sweta68 

Where to add this code?

Userlevel 4
Badge +1

Hi All,

Need to clear the data view in the graph in the beginning. Currently following view returns data from the table. But I need to remove coming data from the view and show the grid empty(As per attached image).

public SelectFrom<HMRCVendorRegisterDetail>.View VendorRegisterDetail_X;

Can someone help me out?

Thanks

When do you expect to display the data in the grid?
What data should it display?

Hi @vardan22 

After adding new record button then verify the particular record(s) using verify vendor button click event and do the save. 

I think you just need to add condition with created date in your view declaration:
 

public SelectFrom<HMRCVendorRegisterDetail>.Where<HMRCVendorRegisterDetail.createdDateTime.IsGreater<AccessInfo.businessDate.FromCurrent>>.View VendorRegisterDetail_X;

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved