Forum Discussion

anhht-hue's avatar
anhht-hue
Ideator III
6 years ago
Solved

How to update file attached to Document without remove old file and re-add ?

Hi everybody, please support me for this situation,

In my case,

1. I created new Document and attached a text file (Document generation = 1)

2. When I update Document, If file is attached have file name is same with old file in Aras server -> My code will remove old file with "delete" action (Document generation  = 2)

3. After that it will re-add new file with "add" action (Document generation  = 3) 

Requirement: After Update document -> Document generation must be 2. And file attached in tag document is only "new file" (If not delete old file and re-add, Aras will be create 2 files with same name but different content)

Thanks so much.

  • Hello,

    The simplest solution to this would be to use the version="0" attribute on your Document in the query you run in step 2. This will prevent the Document from being versioned when you delete the file with the same name. You can also check out this blog post for some other handy attributes you can use in AML queries. 

    Chris


    Christopher Gillis

    Aras Labs Software Engineer

3 Replies

  • Hello,

    The simplest solution to this would be to use the version="0" attribute on your Document in the query you run in step 2. This will prevent the Document from being versioned when you delete the file with the same name. You can also check out this blog post for some other handy attributes you can use in AML queries. 

    Chris


    Christopher Gillis

    Aras Labs Software Engineer

    • anhht-hue's avatar
      anhht-hue
      Ideator III

      Thanks so much Chris. It works ^^

  • Hi Anhht,

    I am working on the same functionality as you did, could you please share your code with me? My code has something odd issue. Thank you very much. 

    Best,Jen