Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

Adjust content in a couple of fields

I need to run an agent on a bunch of selected records that will do the following:

1) Check to see if the Categories field contains "Competitive Agents" and the SubCategories field contains the substring "Reboxetine -- "

If the above is false
2) Do nothing

If true
3) Overwrite the contents of the Categories field with the string "Reboxetine" and remove the substring "Reboxetine -- " from the SubCategories field and capitalize the first letter of the remaining SubCategories field contents.

Example:

We start with

Categories = "Competitive Agents"
SubCategories = "Reboxetine -- adverse effects"

we end up with

Categories = "Reboxetine"
SubCategories = "Adverse effects"

I haven't done any Notes work in a gazillion years and would prefer to find a way to do the above using formula rather than script, but will be VERY HAPPY to get anything that does the trick. Please provide as much detail as possible

Thanks!
0
GessWurker
Asked:
GessWurker
  • 6
  • 4
1 Solution
 
HemanthaKumarCommented:
Try this in your agent...

@if( @Contains(Categories;"Competivice Agents") &  @Contains(SubCategories;"Reboxetine -- ") ; @return(0); "");
FIELD Categories := "Reboxetine";
FIELD SubCategories := "Adverse effects";
""

~Hemanth
0
 
p_parthaCommented:
@if (<yourcategoryfieldname>="Competitive Agents" & @contains(<yoursubcategoryfieldname>;"Reboxetine--");@do(@setfield(<yourcategoryfieldname>;"Reobxetine");@setfield(<yoursubcategoryfieldname>;@propercase(@trim(@right(<yoursubcategoryfieldname>;"--")))));@success)

Put this in a agent and make it to run on selected documents. Also change the <yourcategoryfieldname> to your categoryfield name and subcategory also

Partha
0
 
GessWurkerAuthor Commented:
~Hemanth:

Your suggestion will only work for records that have "Reboxetine -- adverse effects" in the SubCategories field. I need a more intelligent agent. There are many possibilities for what might be in the SubCategories field. Such as:

Reboxetine -- depression
Reboxetine -- reviews
Reboxetine -- drug interactions
Reboxetine -- seasonal affective disorder
Reboxetine -- any number of possibilities
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
p_parthaCommented:
did u try mine?...

@if (Categories="Competitive Agents" & @contains(subcategories;Reboxetine--");@do(@setfield(Categories;"Reobxetine");@setfield(subcategories;@propercase(@trim(@right(subcategories;"--")))));@return(0))

Partha
0
 
p_parthaCommented:
Ok try this , it will definitely work:


@If (Categories="Competitive Agents" & @Contains(subcategories;"Reboxetine--");@success;@return(""));

field categories:="Reobxetine";
field subcategories:=@ProperCase(@Trim(@Right(subcategories;"--")))

Partha
0
 
p_parthaCommented:
if there is a space after "Reboxetine--" then try this:

@If (Categories="Competitive Agents" & @Contains(subcategories;"Reboxetine --");@success;@return(""));

field categories:="Reobxetine";
field subcategories:=@ProperCase(@Trim(@Right(subcategories;"--")))

Partha
0
 
GessWurkerAuthor Commented:
There is a space. Your first suggestion didn't work. Now trying the second...
0
 
GessWurkerAuthor Commented:
Partha:

Almost! Just one thing. I only want propercase on the first word in the SubCategories field.

i.e., a SubCategories field that contains  

Reboxetine -- drug interactions

should convert to

Drug interactions

NOT

Drug Interactions
0
 
p_parthaCommented:

@If (Categories="Competitive Agents" & @Contains(subcategories;"Reboxetine --");@success;@return(""));

FIELD categories:="Reobxetine";
FIELD subcategories:=@UpperCase(@Left(@Trim(@Right(subcategories;"--"));1)) +@RightBack(@Trim(@Right(subcategories;"--"));1);

Partha
0
 
GessWurkerAuthor Commented:
Perfect!
0
 
p_parthaCommented:
Thanks for the points :)

- Partha
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now