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
Swap Delimiters functionality, mixed delimiter scenario #486
Comments
I'm not really sure I understand this issue completely. Is it just when using the Define Measure feature when you already have a partial query using the Other delimiter style? A query with a mixture of delimiter styles would be impossible to reliably swap delimiters on, but I could fix this by running the swap delimiters code before injecting the measure expression into the edit window (since all DAX code is always stored with the US delimiter style inside the model). If there are scenarios other then using Define Measure can you add some example DAX Queries that exhibit this issue? |
With using Define Measure is the only scenario where I have encountered the issue, and I understand that it is somewhat an edge use case. I guess running the swap delimiters code before injecting the measure expression into the edit window would be a solution for that scenario. What is really interesting to me is that there seems to be a way that the functionality understands the first delimiter style that is in use in the syntax. For example: This is what it ends up with: Scenario 1 from my explanation above could be a query like this: IF( [SomeMeasure] = TRUE() ; 2.5 , 2.5 ) This is what it ends up with: |
Thank you in advance for the time you dedicate to the issues I post! |
Yes, the swap delimiters functionality is specifically designed in this way so that you can paste in example code from a website and swap it to your delimiter style or you could write some code in your delimiter style then swap the delimiters and send the code to someone that uses the alternate style. As such I make no assumptions about the delimiters and instead scan the expression and attempt to infer the delimiter style from the first usage that is found. I've put in a fix to make sure that the DEFINE MEASURE feature generates the code with the user specified delimiter style and I think that is the best fix for this issue. That should at least prevent DAX Studio from generating code with mixed delimiters I don't think there is any reliable way of dealing with mixed delimiter styles other than throwing an error and getting the user to fix this as there are a lot of ambiguous code patterns that could be introduced. |
Describe the bug
This one is a bit more tricky than the one I submitted yesterday. The swap delimiters functionality gets confused in a mixed delimiter scenario and does not achieve the intended purpose of converting the delimiters.
After some testing this is what I found to happen:
Scenario 1: Query starts with a semicolon (";") delimiter for an argument and tries to transition to comma (",") delimiter for arguments and dot (".") for numbers
Scenario 2: Query starts with a comma (",") delimiter for a number and tries to transition to comma (",") delimiter for arguments and dot (".") for numbers
This conversion happens:
After the swap the query ends up in this state:
Scenario 3: Query starts with a comma (",") delimiter for an argument and tries to transition to comma (";") delimiter for arguments and comma (",") delimiter for numbers
Scenario 4: Query starts with a dot (".") delimiter for a number and tries to transition to comma (";") delimiter for arguments and comma (",") delimiter for numbers
This conversion happens:
After the swap the query ends up in this state:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The expected behavior would be:
In Scenario 1 and Scenario 2 as described above comma (",") delimiters for arguments to not get converted to dot (".") delimiters.
In Scenario 3 and Scenario 4 as described above comma (",") delimiters for numbers to not get converted to semicolon (";") delimiters.
The text was updated successfully, but these errors were encountered: