FieldCompareValuePredicate

Posts   
 
    
Guyv3r
User
Posts: 2
Joined: 09-Jun-2008
# Posted on: 09-Jun-2008 16:44:28   

Hello,

im using llbl: Designer version: 2.0.0.0 Runtime libraries version: 2.0.0.0 MSSQL 2005

first of all let me congratulate you for this fine tool stuck_out_tongue_winking_eye

Im trying to make a "simple" filter which returns all rows in a table with the value >= x but so far im getting no results...

Try n1:

public EntityCollection<MandatariosEntity> pesquisaMandatarios(EmpresasEntity empresa, string codigo, int nif, string nome)
        {
            EntityCollection<MandatariosEntity> lista = new EntityCollection<MandatariosEntity>();
            IRelationPredicateBucket filter;
            DataAccessAdapter adapter;

            adapter = new DataAccessAdapter();
            filter = new RelationPredicateBucket();
 PredicateExpression pred1 = new PredicateExpression(MandatariosFields.Mandatario >= codigo);
            PredicateExpression pred2 = new PredicateExpression(MandatariosFields.Nif >= nif);
            PredicateExpression pred3 = new PredicateExpression(MandatariosFields.Nome >= nome);

            filter.PredicateExpression.Add(MandatariosFields.Empresa == empresa.Empresa);

            filter.PredicateExpression.Add(pred1);
            filter.PredicateExpression.Add(pred2);
            filter.PredicateExpression.Add(pred3);

            adapter.FetchEntityCollection(lista, filter);

            return lista;
        }

Tried with FieldCompareValuePredicate but still no results :S

Try n2:

public EntityCollection<MandatariosEntity> pesquisaMandatarios(EmpresasEntity empresa, string codigo, int nif, string nome)
        {
            EntityCollection<MandatariosEntity> lista = new EntityCollection<MandatariosEntity>();
            IRelationPredicateBucket filter;
            DataAccessAdapter adapter;

            adapter = new DataAccessAdapter();
            filter = new RelationPredicateBucket();

            filter.PredicateExpression.Add(MandatariosFields.Empresa == empresa.Empresa);

            filter.PredicateExpression.Add(new FieldCompareValuePredicate(MandatariosFields.Mandatarios, null, ComparisonOperator.GreaterEqual, codigo));
            filter.PredicateExpression.Add(new FieldCompareValuePredicate(MandatariosFields.Nif, null, ComparisonOperator.GreaterEqual, nif));
            filter.PredicateExpression.Add(new FieldCompareValuePredicate(MandatariosFields.Nome, null, ComparisonOperator.GreaterEqual, nome));

            adapter.FetchEntityCollection(lista, filter);

            return lista;
        }

if anyone can tell me what im doing wrong i would appreciate it disappointed

Gui

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 10-Jun-2008 07:01:20   

Hi Gui,

I fail to see any obvious missing thing in your code. Could you please make sure of these three things:

  1. Your method is receiving valid params values.
  2. The generated SQL is correct. (Ref: LLBLGenPro Help - Using the generated code - Troubleshooting and debugging).
  3. You have the latest v2.0 runtime libraries (note: v.20.0.0 isn't the RTL version, please check this).

Saludos,

David Elizondo | LLBLGen Support Team
Guyv3r
User
Posts: 2
Joined: 09-Jun-2008
# Posted on: 11-Jun-2008 13:03:10   

Hey,

  1. Tracked everything i could and it is receiving valid parameters.

Method Enter: CreatePagingSelectDQ
Method Enter: CreateSelectDQ
Method Enter: CreateSelectDQ
Generated Sql query: 
    Query: SELECT [AJW].[dbo].[MANDATARIOS].[MANDATARIO] AS [Mandatario], [AJW].[dbo].[MANDATARIOS].[EMPRESA] AS [Empresa], [AJW].[dbo].[MANDATARIOS].[SOLICITADOR] AS [Solicitador], [AJW].[dbo].[MANDATARIOS].[NOME] AS [Nome], [AJW].[dbo].[MANDATARIOS].[NIF] AS [Nif], [AJW].[dbo].[MANDATARIOS].[MORADA] AS [Morada], [AJW].[dbo].[MANDATARIOS].[LOCALIDADE] AS [Localidade], [AJW].[dbo].[MANDATARIOS].[CODIGO_POSTAL] AS [CodigoPostal], [AJW].[dbo].[MANDATARIOS].[TELEFONE] AS [Telefone], [AJW].[dbo].[MANDATARIOS].[TELEMOVEL] AS [Telemovel], [AJW].[dbo].[MANDATARIOS].[FAX] AS [Fax], [AJW].[dbo].[MANDATARIOS].[EMAIL] AS [Email], [AJW].[dbo].[MANDATARIOS].[CEDULA] AS [Cedula], [AJW].[dbo].[MANDATARIOS].[OBSERVACOES] AS [Observacoes] FROM [AJW].[dbo].[MANDATARIOS]  WHERE ( ( [AJW].[dbo].[MANDATARIOS].[EMPRESA] = @Empresa1 AND ( [AJW].[dbo].[MANDATARIOS].[MANDATARIO] >= @Mandatario2) AND ( [AJW].[dbo].[MANDATARIOS].[NIF] >= @Nif3) AND ( [AJW].[dbo].[MANDATARIOS].[NOME] >= @Nome4)))
    Parameter: @Empresa1 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 2.
    Parameter: @Mandatario2 : AnsiString. Length: 8. Precision: 0. Scale: 0. Direction: Input. Value: "b".
    Parameter: @Nif3 : Int64. Length: 0. Precision: 19. Scale: 0. Direction: Input. Value: 1.
    Parameter: @Nome4 : AnsiString. Length: 40. Precision: 0. Scale: 0. Direction: Input. Value: "b".

Method Exit: CreateSelectDQ
Method Exit: CreatePagingSelectDQ: no paging.

I used the same query generated here with the values it receives and i get results on SQL confused

  1. Sorry about that, its version 2.0.7.424

Don't get it why it doesnt give back anything on the application itself cry

EDIT-- Fixed. Somehow it wasnt filling the grid with proper values... silly me..

Thanks anyway

Gui