Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
how to set 2 value using iwextattr
System
hi.
My metadata capture (datacapture.cfg) having a list of checkbox to set the different values of metadata. Using the GUI, the user are able to set different values but using CLT / IPL, they are not able to set/ update more then one value. if they do using the iwextattr -s, it replce the existing value and set only one value.
my req is to set more then one value using the CLT. how can i do that....?
Thanks in advance....
Find more posts tagged with
Comments
Adam Stoller
You need to retrieve the current value - add then set the value with the old value + your new value
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Migrateduser
hi,
I have the following code to retrieve the EA. can you just let me know how to add the old value + your new value. i mean what will be the correct code....
Edited by r_g on 02/06/06 07:52 AM (server time).
kaalraa
Rishi,
Not seen your code... but its simple... just use -g to extract the value of the attibute. If it is defined value just cancatenate along with new value and set the same using -s. If -g gives u undefined then also set the attribute vaue using -s.
Just try the same.. and revert if you still have any problem.
~ aks
Adam Stoller
The code you show gets all the EAs on the file - I don't see anyplace where you're trying to reset a specific EA entry - so I have nothing to base any code suggestions on.
But in short - you can either use something like:
chomp(my $val = qx($iwhome/bin/iwextattr -g "$eaname" "$fname"));
$val .= ";$newval";
chomp(my $results = qx($iwhome/bin/iwextattr -s "$eaname=$val" "$fname"));
or you can use the '-x' flag and pull the EAs into XML format - and then add the new value that way.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Johnny
I think you're asking how to set more than one value. You do that by providing a coma separated list
EG
iwextattr -s "some_tag=val1,val2,val3"
Just a guess at what your specific issue is.
John Cuiuli
Migrateduser
Thanks john, but my req is to just add the metadata with the existing one so it will looks like :
TeamSite/Metadata/microsite: 5
TeamSite/Metadata/microsite: 1
TeamSite/Metadata/microsite: 33
Migrateduser
thanks ghoti, i will try to do that way....
jbonifaci
Thanks john, but my req is to just add the metadata with the existing one so it will looks like :
TeamSite/Metadata/microsite: 5
TeamSite/Metadata/microsite: 1
TeamSite/Metadata/microsite: 33
Then you have a requirement you can't meet. You can not have more than one extended attribute with the same name. You will either need to use a delimiter, as everyone else has said, or different variable names. For example:
TeamSite/Metadata/microsite
1
: 5
TeamSite/Metadata/microsite
2
: 1
TeamSite/Metadata/microsite
3
: 33
~Jeff
Adam Stoller
FYI - I believe the default is semi-colon separated list, not comma-separated (though I could be wrong about this)
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Migrateduser
Hi ghoti,
here is my code. can you give me the direction, how to get the first metadata attributes and set teh same on 2nd.
many thanks
#!/usr/iw-home/iw-perl/bin/perl
###################################################################################
# AUTHOR: RISHI GUPTA
#
# This script should be run on the old TeamSite server (i.e. the content source)
# It uses the ls command to recursively list all files in your backing store.
# It then checks each file for EAs (using iwextattr -l), and then prints output to the screen.
###################################################################################
use TeamSite::Config;
my $iwhome = TeamSite::Config::iwgethome();
my $iwmount = TeamSite::Config::iwgetmount();
$path = $ARGV[0] ;
$iwextattr = "$iwhome/bin/iwextattr" ;
@list
= `ls -1R $path` ;
chomp(
@list
) ;
foreach (
@list
)
{
if ($_ =~ /:/) {
$prefix = $_;
$prefix =~ s/://g;
$prefix .= "/";
$prefix =~ s/\/iwmnt\/default\///g;
#print "prefix: $prefix\n";
next;
}
if (!$_) { next; }
$filename = $_ ;
$vpath = $filename ;
$vpath =~ s/.*\/default\/(.*)$/$1/g;
$vpath =~ s/\\/\//g;
$vpath = $prefix . $vpath;
$rpath = "/iwmnt/default/" . $vpath;
@attr
= `$iwextattr -l $rpath` ;
#print "running $iwextattr -l $rpath\n";
chomp(
@attr)
;
foreach(
@attr)
{
print "/iwmnt/default/" . $vpath . "=" . $_ . "\n" ;
}
}
jbonifaci
The script you posted is only meant to print out the extended attributes for files. It says exactly this in the description. Do you have any idea what the script is even doing? As several people have already said, if you want to get EAs, use iwextattr -l and store the results in a hash. If you want to set EAs, use iwextattr -s. And you can not have more than one EA with the same name, as everyone has already pointed out to you.
~Jeff
Migrateduser
this is the initial script and i use -l for testing purpose. my req is i have 2 drop down select list (source and destination) in my workflow. so if user select any opt from source select list, the same EA needs to be set on second select list value.
jbonifaci
Ok, so you have two selects. You get the value from select 1 and 2 and store them in $selectOneValue and $selectTwoValue. You then set your eas:
`iwextattr -s "selectOneValueEA"="$selectOneValue" $dcrPath`;
`iwextattr -s "selectTwoValueEA"="$selectOneValue;$selectTwoValue" $dcrPath`;
Make the needed modifications to make it work in your script and you're good to go.
~Jeff
Migrateduser
can you just correct me to get the first value of the following. in your reply
`iwextattr -s "selectOneValueEA"="$selectOneValue" $dcrPath`;
or
`iwextattr -g "selectOneValueEA"="$selectOneValue" $dcrPath`;
jbonifaci
My example was setting, not getting. I would assume the values you are getting are not EAs yet, but coming from post data. If they are already EAs, why would you need to get them and set them again?
~Jeff
Adam Stoller
r_g - please carefully re-read all the responses you got in this thread - the information is there.
If you need someone else to write the code for you - hire them. IMO it would be a waste of your money because this is trivial stuff - but if you can't hack it yourself don't expect everyone here to do it for you for free.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com