Solved

Problem filtering Sql view in Grid

  • 30 July 2021
  • 2 replies
  • 96 views

Userlevel 2

Hello Good Night. I have a problem filtering a Sql view. 

 

I have a grid and i want to asign the vendor name in the corresponding column when i select a new vendor. I use de FieldUpdated Event. Then event works but when i want to filter by V_CEVendors (My Sql view) , the condition not work. I did a test with the table BAccount and apply the same filter and it worked. For which I do not understand the reason that with the sql view my filter is not working

 

First scenario: FieldUpdated with mi SQL View V_CEVendors (not working)

  • In the IdTest column I am sending the value of the selected VendorId, but when I enter the filter the “itemovista” does not return anything.
  • I have checked the fields of my view and they are all correct.
    public SelectFrom<V_CEVendors>.View viewV_CEVendors;    

protected void _(Events.FieldUpdated<CEEstimateEstimate, CEEstimateEstimate.idTest> e)
{

var row = (CEEstimateEstimate)e.Row;



V_CEVendors itemovista = viewV_CEVendors.Select()
.Where(item => item.GetItem<V_CEVendors>().Vendor_Id == row.IdTest).FirstOrDefault();

if(itemovista!=null)
{

row.VendorName = itemovista.Vendor_Name;

}
}

Second scenario: I test with the BAccount table and it works.

  • In the IdTest column I am sending the value of the selected VendorId, but when I enter the filter the “itemovista” does return the correct value.
public SelectFrom<BAccount>.View viewBAccount;    

protected void _(Events.FieldUpdated<CEEstimateEstimate, CEEstimateEstimate.idTest> e)
{

var row = (CEEstimateEstimate)e.Row;

BAccount itemovista = viewBAccount.Select()
.Where(item => item.GetItem<BAccount>().BAccountID== row.IdTest).FirstOrDefault();



if(itemovista!=null)
{

row.VendorName = itemovista.AcctName;

}
}

 

when I want to filter through the view nothing happens, does anyone know why?

 

Thanks for your help

 

icon

Best answer by eddiedaco 27 October 2021, 02:04

View original

2 replies

Userlevel 7
Badge +12

Hi @eddiedaco  Can you please let me know what is your filter view here ?

Userlevel 2

Hi @Naveen B  a lot of thanks for your help. The error was int the keys of he DAC (SQL VIEW) view. I put the correct keys on my DAC and it works!

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 — 2020  Acumatica, Inc. All rights reserved