Mayan EDMS index reference post

Questions, comments, discussions. Over time certain topics might be moved to their own category.
ulli
Posts: 2
Joined: Sun Aug 04, 2019 6:13 pm

Re: Mayan EDMS index reference post

Post by ulli » Sun Aug 04, 2019 6:24 pm

I tried several syntaxes to create an index based on file metadata but without success.
The index is always empty. What I do wrong?
{{ document.file_metadata_value_of.FileType }}

The file metadata manager shows the Key "FileType" in all files.

simeon
Posts: 6
Joined: Thu Jan 31, 2019 10:54 am

Re: Mayan EDMS index reference post

Post by simeon » Mon Aug 05, 2019 7:54 am

Is 'FileType' your metadata type 'Internal Name'?

Here is one of mine:

{{ document.metadata_value_of.department_en }}

Note no 'file_'

Sim

User avatar
rosarior
Posts: 387
Joined: Tue Aug 21, 2018 3:28 am

Re: Mayan EDMS index reference post

Post by rosarior » Tue Aug 06, 2019 5:19 am

To access the file metadata you also need to specify the internal name of the driver because multiple drivers can return information for a single document.
To access the FileType value from the EXIFTool driver (the default), use:

{{ document.file_metadata_value_of.exiftool_FileType }}

simeon
Posts: 6
Joined: Thu Jan 31, 2019 10:54 am

Re: Mayan EDMS index reference post

Post by simeon » Tue Aug 06, 2019 8:02 am

Oh interesting, didn't know there were different drivers. Are there docs on this?

ulli
Posts: 2
Joined: Sun Aug 04, 2019 6:13 pm

Re: Mayan EDMS index reference post

Post by ulli » Tue Aug 06, 2019 7:39 pm

@rosarior: Can be so easy...Thanks a lot!

monadnock
Posts: 3
Joined: Thu Aug 08, 2019 7:50 pm

Re: Mayan EDMS index reference post

Post by monadnock » Thu Aug 08, 2019 7:53 pm

Is there a way to view Django template errors or get some troubleshooting output when index templates fail to produce the desired results? They aren't in the docker logs output and I cannot find them in the menus...

It's very frustrating to play "guess the problem" with a moderately complex index template.

Example:

Code: Select all

{% if document.metadata_value_of.date_issued %}                                                                               
    {% if document.metadata_value_of.date_issued|slice:"5:7" in '10,11,12' %}                                                 
        FY{{ document.metadata_value_of.date_issued|slice:":4"|add:"1" }}                                                     
    {% elif  document.metadata_value_of.date_issued|slice:"5:7" in '01,02,03,04,05,06,07,08,09'  %}                           
        FY{{ document.metadata_value_of.date_issued|slice:":4" }}                                                             
    {% else %}                                                                                                                
        Unknown                                                                                                               
    {% endif %}                                                                                                               
{% elif document.file_metadata_value_of.ModifyDate %}                                                                         
    {% if document.file_metadata_value_of.ModifyDate|slice:"5:7" in '10,11,12' %}                                             
        FY{{ document.file_metadata_value_of.exiftool_ModifyDate|slice:":4"|add:"1" }}                                        
    {% elif  document.file_metadata_value_of.exiftool_ModifyDate|slice:"5:7" in '01,02,03,04,05,06,07,08,09'  %}              
        FY{{ document.file_metadata_value_of.exiftool_ModifyDate|slice:":4" }}                                                
    {% else %}                                                                                                                
        Unknown                                                                                                               
    {% endif %}                                                                                                               
{% else %}                                                                                                                    
    Unknown                                                                                                                   
{% endif %}
Fairly straight forward fiscal year calculation (possibly from metadata *or* file metadata). Produces no documents, but it's not possible to tell why. If there's no errors in the template, then at worst all the documents should show up under "Unknown"...

Is there a better way to test for the existance of optional metadata? Is there another template problem? It's very difficult to track down these sorts of issues.

Ralf
Posts: 2
Joined: Thu Sep 12, 2019 9:25 am

Re: Mayan EDMS index reference post

Post by Ralf » Thu Sep 12, 2019 9:56 am

Hi, thanks for making this great software. I am quite new to it and i only try to use if for a small amount of private documents, but i have already learned a lot.

However one thing that i could not figure out yet but which would be very helpful for me:

Is it possible to index documents which are in sub-cabinets of a certain cabinet?
example cabinet Structure:
|
--- Insurance
------Type 1
---------Vendor A
---------Vendor B
------Type 2
---------Vendor A
---------Vendor B
--- other cabinets

Is it possible to get an index of all the documents from the sub-cabinets of only Type 1 ? Or even all documents in sub-sub-cabinets of Insurance?

I hope my question is clear enough.
Kind Regards,
Ralf

KevinPawsey
Posts: 85
Joined: Wed Aug 22, 2018 2:52 pm

Re: Mayan EDMS index reference post

Post by KevinPawsey » Thu Sep 26, 2019 10:04 am

Hi Ralf,

you might be able to use the "document.cabinets" function in conjunction with this code:

Code: Select all

{% if document.cabinets.count == 0 %} None
{% else %}
{% for cab in document.cabinets.all %}
{{ cab.label }}
{% endfor %}
{% endif %}
The above creates a nested cabinets kind of index, maybe in the initial "if" statement you can pick out the Insurance cabinet.

I shall have a play with this and see if I can work out how this would work and get back to you... if you found a solution, then let me know :)


Kevin
Running Mayan-EDMS on: OpenMediaVault, (Docker plugin), on x86 dual-core

Ralf
Posts: 2
Joined: Thu Sep 12, 2019 9:25 am

Re: Mayan EDMS index reference post

Post by Ralf » Sat Sep 28, 2019 1:18 pm

Hi Kevin,

unfortunately i could not figure out how to get informations about the parent cabinets or full cabinet path using document.cabinets for indexing.

My workaround at the moment: I use the rest api to write the cabinet path into a meta data field, and that meta data field is then used for the indexing.

But i am still interested if there is a better solution.

Ralf

Post Reply