How to test a value against a filter

Evert-JanEvert-Jan Member Posts: 36
Hi all,

I saw already a topic about the same thing (more or less):
http://www.mibuso.com/forum/viewtopic.php?f=23&t=22303
However, that solution does not fit for my situation.

My situation:
- a value (datatype = text with length = 250).
- another value that contains a filter. Examples of a filter: '<>abc' , 'abc|def' , etc.

My question: is there an easy way to check that the 1st value matches the filter in the 2nd value?
I'm afraid there is not. But you never know. That's why I ask it here.
Thanks for reading.
Regards,
Evert-Jan

Answers

  • kitikkitik Member Posts: 230
    Both values apply to the same field? The filter one seems to apply to an integer field, but the other one is text...

    If both applies to the same field I would do it as ara3n said on the other topic. If not you'll have to give more details.

    Salut!
    Laura Nicolàs
    Author of the book Implementing Dynamics NAV 2013
    Cursos Dynamics NAV (spanish) : http://clipdynamics.com/ - A new lesson released every day.
  • Evert-JanEvert-Jan Member Posts: 36
    To keep it easy, both values have the same datatype
    Regards,
    Evert-Jan
  • kitikkitik Member Posts: 230
    Why the proposed code don't fit your needs?
    Is it because you don't have any table containing all the possible values?

    Salut!
    Laura Nicolàs
    Author of the book Implementing Dynamics NAV 2013
    Cursos Dynamics NAV (spanish) : http://clipdynamics.com/ - A new lesson released every day.
  • Evert-JanEvert-Jan Member Posts: 36
    Well, I try to explain. :-k

    I'm writing some generic code that will be used for many tables.
    I only have a RecordRef variable as input.
    And I know you can do a FIND on a RecordRef variable.
    But the function that I'm writing can be called from the OnInsert trigger of a table.
    So, setting a filter on the RecordRef and doing a FIND will not work, because I even don't know if that record does already exist.

    I hope this is enough explanation.
    Regards,
    Evert-Jan
  • FDickschatFDickschat Member Posts: 380
    Maybe I'm misunderstanding this completely but it seems to be rather easy:

    If it is a generic function then use a generic table for your filtertest. It does not matter which table it is, the table just needs a field of the same type and length you want to check, thats all. Check in table 2000000041 (Field) for a table that holds such a field.

    Define a table variable as some table and mark it as temporary.
    Get the value from your Fieldref and store it in your Dummy table, Field x. Insert the record (thats why it should be temporary)
    Apply the filter for field x and check whether you can now find a record.
    Frank Dickschat
    FD Consulting
  • Evert-JanEvert-Jan Member Posts: 36
    Thanks,
    That must be the solution.
    Regards,
    Evert-Jan
Sign In or Register to comment.