How to remove a paragraph in a text part of a webpage


#1

Hello all,

I have a “wordPad” part in a webpage, and according to some conditions, I should to keep or remove some paragraphs.
So I extracted each paragraphs of interest, each one associated to one variable and my problem now is to know how with an “Assign” or other, activity, I can to remove a paragraph please.

Thanks


#2

What is the criteria that determines if the paragraph stays or goes? I would probably compile the text into one variable after making sure it meets the conditions:

finalvar = if ( paragraph1var = condition, finalvar & paragraph1var, finalvar )


#3

Hi @bcarp,

I have few criteria so I can to give you all.

1- In a first time I extract some information’s on a person (country…)
2- After that, I have a letter associate to this person and according to these information’s I should to (or not) remove some paragraphs.
For example: If the “relocation” = No then I remove the paragraph on the relocation (that I extract and associate with a variable).


#4

Please let me know if I understand correctly. You have a list of people and the countries they are located in. You then want to assign certain paragraphs to them based on their location. I’m assuming these paragraphs would then be used for correspondence?


#5

No, I try to explain more accurately:

First step:
I have a candidate page with his country, salary, offer letter template, relocation…
I extract these informations with an out argument

Second step:
Then I open his/her offer letter page(I can to send you a screen if you want, I can’t post it for all).
As you can see, there is a “wordpad” section where there is the offer letter.
And according informations extract in the first step I need to remove or not the paragraph N° x…
So if in the first step, I have “relocation” = No, I should, in the second step, remove the paragraph on the relocation.

Is it clearer for you?


#6

So do you have those headers are same in both first step and second step.?
Like Relocation in step one and a paragraph called relocation.?
IF yes then you can create variable for each paragraph
if(Reloaction[from firststep].tostring.length>0) or particular condition like if(Reloaction[from firststep].tostring.equals(""No)) then remove relocation(index till the next paragraph).


#7

No it’s not the same headers. I use an out argument in a first step and I introduce this value by an in argument in the second step. This ok for my argument and variable headers.

My requirement it’s just how can I remove a part of text after to identify it. My conditions… are clear.


#8

If you exactly know what to remove, you can use String.remove() with proper arguments.


#9

if ( variable.contains(“relocation”) = true, paragraph1, paragraph2)

I may be missing something but would this work?


#10

It’s not working (assign is faulted)


#11

my condition is ok, it’s after to assign a method to delete it.
I try String.Remove() as suggested by @Divyashreem but not working.


#12

Hi @Divyashreem,
Since your last post here, I did a lot of trials as
Var C = VarC.ToString.Remove(VarC)
Var C = VarB.ToString.Remove(VarC)
Var C = VarA.Replace(VarB, " ")

unsuccesfully
WIth
My Variable A is the text
My Variable B the paragraph to delete if the condition is not true
My Variable C is the text without “paragrpah B”

Maybe you can let me know. I suppose I missed something.

Thanks


#13

Hi,

Did u tried replace() function?
you can replace it with null.


#14

If you mean (in my case): Var C = VarA.Replace(VarB, " ")
Yes I try it, unsuccessfully.

I need a solution to remove one paragraph in my text according to a condition so I use before an “if” activity.


#15

Did u assigned the paragraph that u wanna remove, to a variable?? I think then u can replace it with null. so better check your condition works properly or not. And also test the replace or remove function is working without your conditions.


#16

Yes, as I detailled (as an exmple) in my post before your first message:
My paragraph is assign to my variable “VarB”. And then I tested remove and replace functions, unsuccessfully.
Look the combination, maybe I forgot something or the syntax is wrong, but I don’t think so.


#17

Could you share the error message that u are getting while using replace/remove funcions ?


#18

There is no error message, just “Assign Faulted” in my output window.


#19

Could u try like this…
var c = var c.Replace(var a," ").ToString
var c contains your whole text
var a is the paragragh to replace.


#20

Unfortunately he doesn’t work. The Assign is correct because not faulted but the paragraph is not remove :frowning:
Do you think @nyusuf it could be due to it’s in a subwindow in the web page as below (sorry some info are confidential):