Skip to main content
Answer

Problem filtering Sql view in Grid

  • July 30, 2021
  • 2 replies
  • 213 views

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

 

Best answer by eddiedaco

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!

2 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • July 30, 2021

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


  • Author
  • Varsity I
  • Answer
  • October 27, 2021

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!