I want to write string with both Single and Double quotes in Filter expression editor
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I want to Keep both Single quotes and Double quotes in Filter expression editor
Solved! Go to Solution.
- Labels:
- Bug
- Developer Tools
- Preparation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Iirc you’d need to split this into multiple parts where you’re using one or the other, wrapping “ in ‘ and vice versa. In this example I think it’d be:
[Field 1] = ‘“What if I want both ’+”’single quotes’ and “+’”double quotes” in a string”’
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I understand above solution, but my problem was i am creating app and it has dropdown with multiple strings(records) like above. So user will select one value from that dropdown and that user selected value will come to this filter tool because i am using replace specific string in action tool. So every time user will select different string and each string has different number of quotes and in different positions. So i am not understanding how to tackle that problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@VijayAnaparthi I can think of 2 immediate workarounds for this (as the above solutions obviously won’t work for single dropdown selections):
Use a Formula tool to make a copy of your target string field (for example we’ll just call it [Filter]), and either a) use a replace function to replace all “ with ‘, or all ‘ with “, or b) use a Cleanse Data tool to remove all punctuation.
Use the replaced or cleansed version of the string field - [Filter] to feed your dropdown, and then you can use [Filter] = ‘x’ in your filter expression, where ‘x’ is the replaced or cleansed value.
If you replace all ‘ with “ then you’ll obviously need to wrap ‘x’ in single quotes and vice versa if you replace all “ with ‘. If you cleanse and remove all punctuation, you can use it other “x” or ‘x’.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I don't want to loose any single and double quotes from my string. I want exact string that how it is presented in dropdown.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hey @VijayAnaparthi I managed to put something together that will handle this. The values in your dropdown will still appear as normal with double and single quotes mixed, as will your underlying data and the output. All this does is use replace functions to bring the two strings to the same format for the sake of the filter, which doesn't change the appearance of them anywhere else.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank You @DataNath It is working. I appreciate your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @DataNath, Above solution is working perfectly for filter tool. But i am facing one more problem which is lets say i am having one text box which will update the string that we selected from dropdown(here user is entering string from his side in textbox) then above thing wont work(Also i am using formula tool instead of filter). I attached workflow and error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@VijayAnaparthi if you're always going to be replacing this with strings in double quotes then all you need to do is change your Formula to 'x' with single quotes, instead of double. The other way round if you're always replacing with single quoted strings. If not, the issue goes back to my first response to my thread in that you need to wrap double quotes in singles and vice versa, so currently when you try and place "Double quotes" into "x" by replacing the x, this string will become ""Double quotes"". Alteryx will read the replacement as the initial "" (before D) and the rest of the text will be there pertaining to nothing, throwing an error. Because of this, I can't think of a way to dynamically level this out. With your filter, we could temporarily change it to satisfy the Filter tool. However, for the sake of a Formula that replaces the existing value, you'd need to do something like my first response where you basically have to stitch the string together because of the mixed quote types:
