Post

2 followers Follow
0
Avatar

How to remove a line break in a "TextArea" field?

Hi there,

I have a field called "C_cplname" which is a textare field on the project level.
When a subproject has a specific name and the "C_cplname" field is filled out, the content of the field is transfered to the parent project "C_cplname" field and a line break is added (with "\n") between all the contents from the subprojects.
This is done with a custom action.

I have another custom action that deletes the content from the "C_cplname" field in the parent project, if the associated subproject is deleted.
Unfortunately I am not able to get rid of the empty line break in the main project field when the content is removed.

example parent field "C_cplname":
This is subproject 1
This is subproject 2
This is subproject 3

If I delete subproject 2 is looks like this:
This is subproject 1

This is subproject 3

I would like to remove the empty space inbetween. How can I achieve that?

I am using the following formula at the moment that is not working:

$ParentProject.C_cplname = ReplaceString($ParentProject.C_cplname,Trim("\n" + $C_cplname),"")

Any ideas?

Thanks a lot!

Simon Sturzenegger Answered

Please sign in to leave a comment.

4 comments

0
Avatar

There should be an empty line break between "subproject 2" and "subproject 3" in the example. Somehow it was removed after posting.

If I delete subproject 2 is looks like this:
This is subproject 1
<empty line break>
This is subproject 3

Simon Sturzenegger 0 votes
Comment actions Permalink
0
Avatar

Hi Simon,

I've tried to use ReplaceString in Description Field and it seems to be working fine: ReplaceString($Description,"\n","")
What exactly not working? What is the input, what is the result and what is the expected result?

Thanks,
Tamir

Tamir Avital 0 votes
Comment actions Permalink
0
Avatar

Hi Tamir,

Sorry I think I was not specific enough. The field "C_cplname" on every subproject has a one line string in it like for example:
TestMovie_FTR_F-166_DE-XX_DE_51_2K_SCA_20151203_YBE_IOP_VF

Every string represents a movie version with a specific audio and subtitle language.
The "C_cplname" on the parent project of all those subprojects should have all those strings separated by a line break. For example if there would be three subprojects the field of the parent project would look like this:

TestMovie_FTR_F-166_DE-XX_DE_51_2K_SCA_20151203_YBE_IOP_OV
TestMovie_FTR_F-166_DE-EN_DE_51_2K_SCA_20151206_YBE_IOP_VF
TestMovie_FTR_F-166_DE-FR_DE_51_2K_SCA_20151208_YBE_IOP_VF

If we know delete the subproject with the middle string (TestMovie_FTR_F-166_DE-EN_DE_51_2K_SCA_20151206_YBE_IOP_VF), the whole line should dissapear including the gab inbetween.
With the custom function:
$ParentProject.C_cplname = ReplaceString($ParentProject.C_cplname,Trim("\n" + $C_cplname),"")
we were able to replace the string with an empty space, but the gap is still there. We would like to have the strings underneath it to move up so the gap is gone.

I tried your suggestion, but then all the line breaks are gone and the strings are being placed after each other and that is too confusing for our users.

I hope you can better understand what I am talking about now :)

Simon Sturzenegger 0 votes
Comment actions Permalink
0
Avatar

Hi Simon,

I would actually use the Custom Action in the parent project to iterate between subproject and rebuild the field.
For example:
1. Update Field: CPL Name = NULL (of the parent project)
2. Update Field --> Sub Items --> CPL Name
Value: $C_CPLNAME+TargetObject.C_CPLNAME+"\n"

Then all you need is to run it from the parent project level. BTW - I think it is possible to fully automate that with a WR.

Let me know if it makes sense.

Good luck!
Tamir

Tamir Avital 0 votes
Comment actions Permalink