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/casTdeeZLO8JLooks 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.