Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

where clause on text with back slash \ requires 4 back slashes !! #136

Closed
Marouanebouzoubaa opened this issue May 28, 2020 · 5 comments
Closed

Comments

@Marouanebouzoubaa
Copy link

Marouanebouzoubaa commented May 28, 2020

First, excellent work and keep up maintaining this project.

I encountered a weird problem where I have a text column with text like domain\abc
to make the where condition work, i had to encode the back slash twice like this !

where:"My_Field = 'domain\\\\abc'",

I am not sure if this is the default behavior or a bug, but i found on the documentation of the Add function the following:
note: A person must be provided as "-1;#email" (e.g. "-1;#[email protected]") OR NT login with double \ (eg "-1;#europe\\foo_bar") OR the user ID as a number

Is there a documentation that explains how the where works for different column types and wich operators can work with each column type. although the generated documentation is good enough, most of the time it is trial and error process. having also this documentation will make a better person.

Note: The editor for reporting the issue in github also shows two back slashes as one, so I had to double the number of slashes in the message to have the correct number shown.

Thx

@Marouanebouzoubaa Marouanebouzoubaa changed the title where clause on text with back slash \ requires 4 bach slashes !! where clause on text with back slash \ requires 4 back slashes !! May 28, 2020
@Aymkdn
Copy link
Owner

Aymkdn commented May 28, 2020

As you probably know, \ is a special character in JavaScript (and other languages). It's why you need to have 2 \\ in JavaScript to represent 1 \ at the end.

Regarding your 'domain\\\\abc', it might be because the value is stored as 'domain\\abc' so 4 \ are required to return 2 \. I don't think it's a bug of SharepointPlus but more something related to the way your data is stored?!

Is there a documentation that explains how the where works for different column types and wich operators can work with each column type

I'm not sure to understand this question. As you said, I gave some tips in $SP().list().add() on how to deal with some special types. It's not something related to SharepointPlus but to how Sharepoint handles some column's types, that is not also simple…

although the generated documentation is good enough, most of the time it is trial and error process. having also this documentation will make a better person.

I'm very sorry but I didn't understand this part… If you have an example of what you mean?

@Aymkdn Aymkdn added the waiting-for-requestor Waiting for the requestor to reply label May 28, 2020
@Marouanebouzoubaa
Copy link
Author

Hi,

My data is stored with one and only one back slash as 'domain\abc', I have created another sample example to illustrate what i was saying. Please see below my test on chrome console showing two queries, the one with 4 slashes works whereas the one with two return 0 rows.
I suggest that you re-create the sample, maybe the versions of SP we using are different. I am using the browser version v6.1.1.
For my comment regarding the documentation, forget what I said, by practicing and doing more examples, I find all what i need.

SharepointPlus query text with back slash

Cheers,

@no-response no-response bot removed the waiting-for-requestor Waiting for the requestor to reply label May 31, 2020
@Aymkdn
Copy link
Owner

Aymkdn commented May 31, 2020

I'll have a look later this week (on Tuesday or Wednesday)

Aymkdn added a commit that referenced this issue Jun 2, 2020
Fixed issue #136
@Aymkdn
Copy link
Owner

Aymkdn commented Jun 2, 2020

I've just fixed it in v6.1.2

Thanks.

@Aymkdn Aymkdn closed this as completed Jun 2, 2020
@Marouanebouzoubaa
Copy link
Author

Tested the fix in v6.1.2, It works.

Thx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants