Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to be able to replace a user input with just part of the users input.
In this case it's aggregate selection. Somewhere in every aggr name is either a1,a2,a3,or a4. Unfortunatly its not always in the same place.
I was hopeing for something like;
if( inputStr = [a1])
{
return "a1";
}
that way Aggr1_a1_oracle_prod and filer2_15k_esx_fcp_a1 would each let me replace them with a1. This doesn't work, and programing isn't my strong suite. I have to do something similar for several diparent examples so if a regex match could be shown it would really help me out. There are at least a hundread aggregates and I dont' want to have to do if/else for all of them.
Thanks
Solved! See The Solution
1 ACCEPTED SOLUTION
dblackwe has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can define a function as below and use it in your workflow. Its also ignore case senstivity for A1 and a1 in the aggr names. If you don't want that then remove toLowerCase() from the below and it should be fine.
====
def getString(str)
{
import java.lang.*;
if( str.toLowerCase().contains("a1") ) return "a1";
else if ( str.toLowerCase().contains("a2") ) return "a2";
else if ( str.toLowerCase().contains("a3") ) return "a3";
else if ( str.toLowerCase().contains("a4") ) return "a4";
else return str;
}
===
sinhaa
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
2 REPLIES 2
dblackwe has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can define a function as below and use it in your workflow. Its also ignore case senstivity for A1 and a1 in the aggr names. If you don't want that then remove toLowerCase() from the below and it should be fine.
====
def getString(str)
{
import java.lang.*;
if( str.toLowerCase().contains("a1") ) return "a1";
else if ( str.toLowerCase().contains("a2") ) return "a2";
else if ( str.toLowerCase().contains("a3") ) return "a3";
else if ( str.toLowerCase().contains("a4") ) return "a4";
else return str;
}
===
sinhaa
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sinhaa
This worked perfectly. Thank you so much, again you save the day.
David
