fill metadata fields with values automatically when you upload new documents

We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules
Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
Post Reply
cherifmad
Junior Boarder
Junior Boarder
Posts: 37
Joined: Tue Apr 03, 2018 6:22 pm

fill metadata fields with values automatically when you upload new documents

Post by cherifmad » Wed May 16, 2018 5:36 pm

I would like to fill metadata some fields with values automatically when you upload new documents . I have view the process to add keywards wizards and groupe property wizards.
But ,when the groupe property is show, there way to have some way to get some fields filled yet .?

Thanks for your understanding

jllort
Moderator
Moderator
Posts: 10830
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: fill metadata fields with values automatically when you upload new documents

Post by jllort » Thu May 17, 2018 6:42 am

You are talking about when is shown the form, some field be set as default values ?

cherifmad
Junior Boarder
Junior Boarder
Posts: 37
Joined: Tue Apr 03, 2018 6:22 pm

Re: fill metadata fields with values automatically when you upload new documents

Post by cherifmad » Fri May 18, 2018 1:17 pm

Yes It is,
And I would like to know also, where OpenKM is going to save the information that we are write in the XML form( the adding Property groupe)?
Is it possible to make some modification on the database of metadata of property group Saved yet ?

jllort
Moderator
Moderator
Posts: 10830
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: fill metadata fields with values automatically when you upload new documents

Post by jllort » Sat May 19, 2018 10:22 am

Try for example setting in the xml definition the value:
https://docs.openkm.com/kcenter/view/ok ... field.html

Code: Select all

<input label="Input label"  name="okp:consulting.input" value="defaultValue"/>
https://docs.openkm.com/kcenter/view/ok ... field.html

Code: Select all

<select label="select label" name="okp:consulting.select" type="simple">
      <option label="one" value="001" />
      <option label="two" value="002" />
      <option label="three" value="003" selected="true"/>
     </select>
That might initialize the form element with these values by default.

cherifmad
Junior Boarder
Junior Boarder
Posts: 37
Joined: Tue Apr 03, 2018 6:22 pm

Re: fill metadata fields with values automatically when you upload new documents

Post by cherifmad » Sat May 19, 2018 9:38 pm

Please, I don't understand you.....
for example: if I have 100 documents and 50 documents have the same imformation as the creator file nameImage,
how to make that each import file with the desktop import, can have the metadata group at the end of the importImage

jllort
Moderator
Moderator
Posts: 10830
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: fill metadata fields with values automatically when you upload new documents

Post by jllort » Mon May 21, 2018 6:09 am

The wizard only works when you uploading a single file. A wizard-based on a queue for it should be implemented as an OpenKM external feature. We have something in customization in professional edition https://www.youtube.com/watch?v=do-uVuk816M what goes in that direction ( Basically it's a small UI created in the combination of SDK4J https://docs.openkm.com/kcenter/view/sdk4j-1.1/),

cherifmad
Junior Boarder
Junior Boarder
Posts: 37
Joined: Tue Apr 03, 2018 6:22 pm

Re: fill metadata fields with values automatically when you upload new documents

Post by cherifmad » Mon May 21, 2018 7:35 am

Thanks @Jlor, for this responses,
I am not a good java developper,
But I would,like to where and how I can use this SDK?
Is it in source code of openkm? Or This SDK is the web ( HTML page ?)
Please can you help to make the same application like the youtube example? "https://www.youtube.com/watch?v=do-uVuk816M"

jllort
Moderator
Moderator
Posts: 10830
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: fill metadata fields with values automatically when you upload new documents

Post by jllort » Tue May 22, 2018 6:43 am

This application is a bootstrap one what into it uses the SDK for JAVA for connecting to OpenKM. The idea is quite easy.
1- Documents are uploaded into /okm:root/import
Then external application
2- List files into ( using SDK )
3- Use preview feature ( from professional version is possible to use it, you should integrate some previewer or apply small changes into OpenKM community code to use it from outside, I should review actual code because I do not have in mind how is it ).
4- Get metadata definition ( SDK )
5- Draw metadata definition
6- Set metadata ( SDK again )

We do not have a sample as a web application with SDK working together. But is quite easy, when you authenticate to the application really you are authenticating to OpenKM across the SDK and you keep user and password for using the application when you are logged into.

The SDK is a library what can be used into your own projects ( https://docs.openkm.com/kcenter/view/sd ... lient.html for JAVA or https://docs.openkm.com/kcenter/view/sdk4net-1.1.2/ for .NET or https://docs.openkm.com/kcenter/view/sdk4php-1.1.2/ for PHP )

cherifmad
Junior Boarder
Junior Boarder
Posts: 37
Joined: Tue Apr 03, 2018 6:22 pm

Re: fill metadata fields with values automatically when you upload new documents

Post by cherifmad » Wed May 23, 2018 3:12 pm

jllort wrote:
Tue May 22, 2018 6:43 am
This application is a bootstrap one what into it uses the SDK for JAVA for connecting to OpenKM. The idea is quite easy.
1- Documents are uploaded into /okm:root/import
Then external application
2- List files into ( using SDK )
3- Use preview feature ( from professional version is possible to use it, you should integrate some previewer or apply small changes into OpenKM community code to use it from outside, I should review actual code because I do not have in mind how is it ).
4- Get metadata definition ( SDK )
5- Draw metadata definition
6- Set metadata ( SDK again )

We do not have a sample as a web application with SDK working together. But is quite easy, when you authenticate to the application really you are authenticating to OpenKM across the SDK and you keep user and password for using the application when you are logged into.

The SDK is a library what can be used into your own projects ( https://docs.openkm.com/kcenter/view/sd ... lient.html for JAVA or https://docs.openkm.com/kcenter/view/sdk4net-1.1.2/ for .NET or https://docs.openkm.com/kcenter/view/sdk4php-1.1.2/ for PHP )
Thanks you a lot Jlort
I do it, this proccess, and I tell you my progression .
I have yet download the SDK for PHP, but, when I launch the php script in my broswer, it is the script, not the web application like youtube video( wizard catalog customization), ( see my screen shot)
thanks for your understanding
Attachments
test2.JPG

jllort
Moderator
Moderator
Posts: 10830
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: fill metadata fields with values automatically when you upload new documents

Post by jllort » Thu May 24, 2018 8:13 am

That is because you have not configured php support in your webserver and is not executed from server side. Google for "enable php" in your Operating system

cherifmad
Junior Boarder
Junior Boarder
Posts: 37
Joined: Tue Apr 03, 2018 6:22 pm

Re: fill metadata fields with values automatically when you upload new documents

Post by cherifmad » Thu May 31, 2018 3:44 pm

jllort wrote:
Thu May 24, 2018 8:13 am
That is because you have not configured php support in your webserver and is not executed from server side. Google for "enable php" in your Operating system
Thanks dear Jllort, I have enable my PHP in windows,
I have maked some test like " addgroup" succesfully, but, If I would like to addgroup form or metadata for each document in one folder ( for exemple the SDK4PHP like the example of sdk4php), Can I make a loop or are you a best way to addgroup property at all documents in the same folder ?

jllort
Moderator
Moderator
Posts: 10830
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: fill metadata fields with values automatically when you upload new documents

Post by jllort » Fri Jun 01, 2018 6:35 pm

You can iterate across al the documents into some folder with the method getDocumentChildren:
https://docs.openkm.com/kcenter/view/sd ... ntChildren

cherifmad
Junior Boarder
Junior Boarder
Posts: 37
Joined: Tue Apr 03, 2018 6:22 pm

Re: fill metadata fields with values automatically when you upload new documents

Post by cherifmad » Sun Jun 03, 2018 7:37 pm

jllort wrote:
Fri Jun 01, 2018 6:35 pm
You can iterate across al the documents into some folder with the method getDocumentChildren:
https://docs.openkm.com/kcenter/view/sd ... ntChildren
thanks Jllort, I have see it but I don't understand well the using of this method. per example, if I have this script, How can I use the getDocumentChildren ?

Code: Select all

<?php

include '../src/openkm/OpenKM.php';

use openkm\OKMWebServicesFactory;
use openkm\OpenKM;

class ExamplePropertyGroup {

    const HOST = "http://localhost:8080/OpenKM/";
    const USER = "okmAdmin";
    const PASSWORD = "admin";

    private $ws;

    public function __construct() {
        $this->ws = OKMWebServicesFactory::build(self::HOST, self::USER, self::PASSWORD);
    }

    public function testAddGroup() {
        try {
            $this->ws->addGroup('/okm:root/SDK4PHP/logo.png', 'okg:consulting');
            echo 'addGroup';
        } catch (Exception $e) {
            var_dump($e);
        }
    }

}

$openkm = new OpenKM(); //autoload

 public function testGetDocumentChildren(){
        try {
            $documents = $this->ws->getDocumentChildren('/okm:root/SDK4PHP/');
            foreach ($documents as $document) {
                var_dump($document);
            }
        } catch (Exception $e) {
            var_dump($e);
        }
    }
$examplePropertyGroup = new ExamplePropertyGroup();
$exampleDocument->testGetDocumentChildren('365dc4a7-9bfb-489f-be19-659f5048dae3');
$examplePropertyGroup->testAddGroup();
?>
I have put the GetDocumentChildren, but an error appear.
can you help me to correct my script in order to apply the "addgroup" in all files of folder SDK4PHP like the one written in my script.
Thank you for your understanding
Will you help me please ? thanks for your understanding

jllort
Moderator
Moderator
Posts: 10830
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: fill metadata fields with values automatically when you upload new documents

Post by jllort » Mon Jun 04, 2018 6:14 pm

In the code shown in our documentation it is looping across all the documents, try it: https://docs.openkm.com/kcenter/view/sd ... ntChildren , then for each document with the uuid variable of each document you can do something ( add group, se metadata etc... )

cherifmad
Junior Boarder
Junior Boarder
Posts: 37
Joined: Tue Apr 03, 2018 6:22 pm

Re: fill metadata fields with values automatically when you upload new documents

Post by cherifmad » Tue Jun 05, 2018 2:04 pm

jllort wrote:
Mon Jun 04, 2018 6:14 pm
In the code shown in our documentation it is looping across all the documents, try it: https://docs.openkm.com/kcenter/view/sd ... ntChildren , then for each document with the uuid variable of each document you can do something ( add group, se metadata etc... )
Please can you make one example to show me the using of obtention of path's folders children( to get a path list) and create a list of addgroup ?
thanks for your understanding

Post Reply