Skip to Content

C4C SDK: Multiple values in query parameters

Hi experts,

I have a situation in a program and we need filter a parameter with several values .

Ex:

Customer, A; B; C;

In my Action we are put the next code:

if ( !this.zztipo_cliente.IsInitial()){

selectionParams.Add(query.zztipo_cliente, "I", "EQ", this.zztipo_cliente);

}

if ( !this.zztipo_cliente1.IsInitial()){

selectionParams.Add(query.zztipo_cliente, "I", "EQ", this.zztipo_cliente1);

}

if ( !this.zztipo_cliente2.IsInitial()){

selectionParams.Add(query.zztipo_cliente, "I", "EQ", this.zztipo_cliente2);

}

if ( !this.zztipo_cliente3.IsInitial()){

selectionParams.Add(query.zztipo_cliente, "I", "EQ", this.zztipo_cliente3);

}

But with this code the query only filter with the last value.

There are some posibities of make like

selectionParams.Add(query.zztipo_cliente, "I", "EQ", this.zztipo_cliente and zztipo_clietne2; zztipo_cliente3; zztipocliente4)

Regards.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 22, 2017 at 09:50 AM

    Hi Carlos,

    I did not got your point exactyl, I havo a doubt that you want to use "OR" or "AND" but if you want to achieve this:
    selectionParams.Add(query.zztipo_cliente, "I", "EQ", this.zztipo_cliente and zztipo_clietne2; zztipo_cliente3; zztipocliente4)

    You can do like below:

    selectionParams.Add(query.zztipo_cliente, "I", "EQ", this.zztipo_cliente);
    selectionParams.Add(query.zztipo_cliente, "I", "EQ", this.zztipo_cliente2);
    selectionParams.Add(query.zztipo_cliente, "I", "EQ", this.zztipo_cliente3);
    selectionParams.Add(query.zztipo_cliente, "I", "EQ", this.zztipo_cliente4);
    Var result = query.Execute(selectionParams);

    This will check all conditions and exactly works as "AND"

    Sin

    Add comment
    10|10000 characters needed characters exceeded