Adding resoure ID to a field

294 views
Skip to first unread message

Torgeir F

unread,
Jun 12, 2014, 7:38:34 AM6/12/14
to resour...@googlegroups.com
Hi

To all you knowledgeable folks:

I have a request from a customer that looks like this case:

1. A user of RS goes to the batch upload page, then fills in all necessary fields, and a field we call ObjectName.
2. The value of the Objectname field is always something like AA-BB-20140101, depending on which user, organization and date it is.
3. The user then clicks Next, and gets the "upload resources" screen.
4. He uploads 15 new resources with the metadata specified in the "batch upload page in step 1.

We then want RS to do THIS by script ot the like, in the same time as it commits new resources to DB:

- Add the Resource ID for the specific Resource to the end of each uploaded resources ObjectName field, so it looks something like this : AA-BB-20140101-833.
 The next resource uploaded then gets AA-BB-20140101-834 and so on, till all 15 uploaded resources have the correct ObjectName.

Is this possible without us coding it ourselves?

Regards

Torgeir 

Brian S

unread,
Jun 13, 2014, 1:56:46 PM6/13/14
to resour...@googlegroups.com
Try this, in system setup go to the ObjectName field and add the following code to the exiftool filter box:

$value .= "-$ref";

Torgeir F

unread,
Jun 16, 2014, 4:55:07 AM6/16/14
to resour...@googlegroups.com
Hi Brian

That's a good suggestion, but this only works if the image has a title in its exif field.
We would like to take whatever the user writes into the ObjectName field when he uploads the resource, and add the ResourceID at the end during the upload process.
I'm not sure if I'm clear enough...

Regards
Torgeir

Allison Stec

unread,
Jun 16, 2014, 11:53:16 AM6/16/14
to ResourceSpace
You might be able to use the onchange macro section to handle this.

Allison Stec
Asset Management Specialist
Colorhythm
http://www.colorhythm.com

Main Office: +1 415-399-9921
Fax: +1 415-399-9928

as...@colorhythm.com


--
ResourceSpace: Open Source Digital Asset Management
http://www.resourcespace.org
---
You received this message because you are subscribed to the Google Groups "ResourceSpace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to resourcespac...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Torgeir F

unread,
Jun 17, 2014, 4:01:31 AM6/17/14
to resour...@googlegroups.com
Hi Allison

I'm guessing you're refering to the Autocomplete macro ?

I've searched around for help on this and found a few topics. I've found this one :

https://groups.google.com/forum/#!searchin/resourcespace/autocomplete$20macro/resourcespace/AHBnqfLMOC0/casTdeeZLO8J

Looks very similar to our issue, but it seems the autocomplete macro thingy isn't documented anywhere, ref:


Matt,

AutoComplete Macro isn't exactly well documented. Certainly not well
enough to use. As for an example for a textbox field, something like:

     return 'Not specified';

would work. At the time a resource is being saved, if the field is
empty  --i.e., strlen(trim($value))==0 where $value is the value of the
field -- then the field's value will be set to the string "Not specified".

In general, the "macro" can be any valid php code. The code will be
executed when a resource is saved and the field in question is empty.
The field's value will be set to whatever the code returns.

Hope this helps,

David

Also, it seems like Dan Huby wrote the Autocomplete Macro function in RS, and it seems it CAN be used for my purpose, but i don't know how ... :/ :

Thanks Jeff - it's really for filling in blank fields automatically.

It was originally developed to automatically complete the title field
if only a caption has been provided, using a simple macro that fetches
the caption and trims it to a smaller size suitable for use as a
title.

But I imagine that you could use it for all manner of other things,
such as combining existing field values or setting a field
conditionally based on other field values, or setting a field based on
a lookup from a remote system. For example, someone enters a project
ID code, and an autocomplete macro on a separate project description
field goes away to a project management system and fetches the project
description from there.

The macro is PHP and just needs to return the value to be used.

So a macro could be simply:

return date("d/m/Y");

... which would automatically complete the field with today's date.

Allison Stec

unread,
Jun 17, 2014, 8:55:16 AM6/17/14
to ResourceSpace
Yes, it isn't well documented, and I actually haven't used it myself. However, it will take php. It's looking like some coding is needed on your end to make this work.

It also sounds like you might have to create an additional field for the combined data, seeing as how it needs to be left blank and the object name must be populated.

Allison Stec
Asset Management Specialist
Colorhythm
http://www.colorhythm.com

Main Office: +1 415-399-9921
Fax: +1 415-399-9928

as...@colorhythm.com


Brian Schwenk

unread,
Jun 17, 2014, 9:12:35 AM6/17/14
to resour...@googlegroups.com
You can also apply the code I gave to the value filter. But that only changes the way the field is displayed to the user. The ObjectName wont have the ref number in the database. Sorry I didn't read the original post carefully enough.
Reply all
Reply to author
Forward
0 new messages