Table FILTER question/problem - CalcFormula SETFILTER

andy76andy76 Member Posts: 616
Dear all,

I am creating a new field in table 27 - Item called "Attachment Presence" that should have a behaviour similar to standard field Comment.
It is a boolean and should be true or false if it exists at least one record in table Record Link No. 2000000068.

In CalcFormula properties I am inserting something like this:

Exist("Record Link" WHERE (Record ID=FILTER()))

but I don't know the right sintax to tell the system this thing

RecordID start with 'Item :' + "No." where:

'Item :' is a fix text
"No." is the key of the table Item (code of article)

If I was writing code directly in C/AL editor the thing could be more simple using %1, %2 and so on....

Do you understand?
Can you help me?

Thank you

Comments

  • matttraxmatttrax Member Posts: 2,309
    Filters in CalcFormulas are hard coded. You can't have a text constant + some field.
  • andy76andy76 Member Posts: 616
    How could I solve my problem in another way?

    Thank you

    Happy Easter
  • matttraxmatttrax Member Posts: 2,309
    You can't use a flowfield. You'd have to create a normal field and make sure it is updated every time a record is inserted / deleted in the Record Link table.
  • andy76andy76 Member Posts: 616
    The real purpose of the development is to display 2 different pictures in Item form to display if there is at least an attachment (stapler_on.bmp) or if there are no attachments (stapler_off.bmp).
    I wanted to exploit the logic under the picture Comment with 2 different pencils pictures.

    Do you have other suggestions?

    A lot of attachment have already been inserted in the system and I cannot set manually the new field, only creating with a massive report but is not very crafty...

    Thank you very much.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    In table 27 add two new fields:

    "Record ID"::RecordID;
    "Link Exists"::Boolean - Flow Field;

    in the "link Exists" field add the flow field formula "Exist("Record Link" WHERE (Record ID=FIELD(Record ID)))"

    Now in the insert, rename and No. fields ad code to update the Record ID field.
    David Singleton
  • andy76andy76 Member Posts: 616
    I was writing the code written on this link:

    viewtopic.php?f=1&t=34687&p=200645#p200645

    but I have the problem of last reply

    Thank you very much
  • andy76andy76 Member Posts: 616
    Can nobody help me?
    What is wrong?

    Thanks
  • ufukufuk Member Posts: 514
    Setting filters on RecordID does not apply. So add a bool return function to recordlink table that you pass your item no. Loop into the recordlink table to query the related field value with your 'Item:'+Item."No." value and exit when true.
    Ufuk Asci
    Pargesoft
  • andy76andy76 Member Posts: 616
    Dear ufuk,

    thank you for your reply but I don't understand very well....
    Should I loop every time all table? I have thousands of record...

    Could you please explain better?

    Andrea
  • andy76andy76 Member Posts: 616
    Being Recordlink a system table, I can not add code to it, isn't it?

    Thanks
  • ufukufuk Member Posts: 514
    You can add function to Record Link table. (but it is not important in this case)

    NAV help says that you cannot set filters on RecordID but you can apply textfilters on it. So I think you can filter like:
    RecLink.SETFILTER("Record ID",FORMAT(prec."Record ID"));
    

    I have tested and got no problem.
    Ufuk Asci
    Pargesoft
  • andy76andy76 Member Posts: 616
    This seems GOOD !!!

    Thank you very much =D> =D>
Sign In or Register to comment.