Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using variable value in replace function

Hi all,

I'm trying to strip out certain userid's from a comment, using the replace function.

-attached is the sample .qvw

First of all I create a table of possible userid's that could be found in a comment.

Then I create a variable called vUser, using these values in this table of UserID's.

Finally I want to be able to use this variable - vUser, in the replace function. replace(comment, $(vUser), '*******').

The problem is that I want to be able to look through the list of UserID's and if it is found in the comment, then replace it with '*******'

Like a find and replace.

How could I go about this?

Any ideas would be appreciated!

Thank you.

4 Replies
Not applicable
Author

hi

create variable, vUser

=Concat(comment,';')

then use

replace(comment, $(vUser), '*******').

Not applicable
Author

Hi Vishwaranjan,

I think the problem is with the SET vUser = PEEK('USERID', 0, 'userids');

It only returns one row, but I need it to look at all records in the list of UserIDs.

nilesh_gangurde
Partner - Specialist
Partner - Specialist

Hii beanz,

instead of set vuser use the Let vUser and that to in the For loop then you will able to get the all the userIds.

for Example.

//**********************************************************//

userid

load * inline [

USERID

A

B

C
D

];

let vRecord = NoOfRows('userid');

for i = 0 to (vRecord) -1

LET vUser = PEEK('USERID', 0, 'userids');

NEXT

//**********************************************************//

The above script will give you the all the userids pass into vUser Variable.

-Nilesh

Not applicable
Author

Thanks for the help.

I'm almost on the right track, but it seems to be giving me 2 lines. One with the replace and one without.

I just need to return the replaced record.

I've attached the .qvw , to show what it is returning.