cancel
Showing results for 
Search instead for 
Did you mean: 

Xacute - SortFilter when FilterValue contains apostrophe

Former Member
0 Kudos

I am using a generic Sort Filter action block in Xacute inside of a repeater loop. The problem is when the FilterValue (which is set to the repeater output value) contains an apostrophe ( ' ). How can I prevent the action block from throwing an error when it encounters this? I tried a stringreplace to add an escape (\) character in front of the apostrophe but that didn't work. Below is the error generated:

Element type "xsl:for-each" must be followed by either attribute specifications, ">" or "/>".

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sue,

I guess you can do one thing.

Replace the value " ' " in the string to be compared to any unusual string like "#"(just an example because this string won't be used in names) and then use " # " in sort string if user entered " ' " in sort expression.

What I mean is use string replace in both string to be compared and sort string.

Thanks & Regards,

Ravi Kumar.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

I too had faced a similar problem, then i tried replacing ' with ' an entity reference for single quote in XML, but it resulted in an exception like

javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: misquoted literal... expected single quote!

which is a problem with Java as it works fine with all the other entity reference like >,<,& and " but not with ' , so I had to develop a different logic where in I used to form a different XML out of the Data source which I had to filter by replacing already existing # with ## and then replacing ' with # and filtering by a value in which "'" was replaced with #

this worked fine for me, I hope this will help you.

Former Member
0 Kudos

You use the following function in your BLS.

stringreplace(string,"'","
").

It will replce the apostrophe ( ' ) by ( \ ).

If you use stringreplace(string,"'","\"), then It can not replce the apostrophe ( ' ) by ( \ ). So you need to use the "
" instead of "\" inside the stringreplace function.

e.g: Here i used stringreplcae("manisha's, "'","
")

The result will be manisha\s.

Thanks,

Manisha

Former Member
0 Kudos

The problem is if I replace the (') with a backslash (\), I change the value and the result of the filter block is not what I need it to be.

Is there any way to make a filter value of "O'CONNER TANKS" work?

Replacing (') with double backslash (
) generates no error but does not filter correctly

Replacing it with backslash aposthrophe (\') generates an error

Replacing with with double backslash apostrophe (
') generates no error but does not filter correctly

Former Member
0 Kudos

There might be a more elegant way to do it, but you could add a column that strips out the " ' " and then filter off of that column.

Former Member
0 Kudos

Hi,

Are you not able to filter by using ( ' ) or by using (
)?

Is this "O'CONNER TANKS" a constant value or the column value will change?

If it is constant then remove the ( ' ) by using stringreplace function and put the value in a column. Then filter that column by value equal to "OCONNER TANKS".

It will work out.

Thanks,

Manisha

Former Member
0 Kudos

Hi,

Even I faced same problem, I was getting value to iBrowser from transaction dynamically here it was just stripping off the value which has '(apostrope).

Eg: if value is 1.25L2.56"2.5' I was getting only 1.25L*2.56" and rest was stripped off.

Here i used stringreplace(" ' "," " ") that means i replaced apostrope with double quote and it worked fine.

This you can do it in frontend or in transaction while putting into document.

I did this in frontend using stringreplace() java function, In transaction use

stringreplace( String , search, replace ) function , use it in row action when you are putting data to Doc.

But there is some problem with apostrope with Action blocks we use it.

Regards,

Rao.

Edited by: Rao on Jun 26, 2008 9:33 AM

Former Member
0 Kudos

Sue,

You can try this:

stringreplace(string,"'","
")

By using this you can replace apostrophe ( ' ) by ( \ ).

Hope this will help you.

Thanks,

Manisha