 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
[12.4.474 Pro] - BUG: $CURRENT(...) broken for SQL Server |
|
The upgrade to 12.4 has caused massive damage to some of my snippets using the $CURRENT(...)$ macro. I have a snippet that I use to add aliases (and then alter them) quickly. Its code is this:
 |
 |
AS [$CURRENT(param1, names_only, dont_replace)$]
|
In the past, when I typed its trigger, this snippet did the following: fetch the first name left from the cursor (after removing the trigger word), add the AS keyword after that name, and copy the name (enclosed within delimiters) after the AS. Quite simple, worked like a charm.
After the upgrade, it behaved oddly, so I checked how it performed now. It turned out, not good at all. I've created a simple scenario with the following three lines, each containing 9 names:
 |
 |
name1, name2, name3, name4, name5, name6, name7, name8, name9
[name1], [name2], [name3], [name4], [name5], [name6], [name7], [name8], [name9]
([name1], [name2], [name3], [name4], [name5], [name6], [name7], [name8], [name9])
|
Typing the trigger word at the end of each line should have turned them into this:
 |
 |
name1, name2, name3, name4, name5, name6, name7, name8, name9 AS [name9]
[name1], [name2], [name3], [name4], [name5], [name6], [name7], [name8], [name9] AS [name9]
([name1], [name2], [name3], [name4], [name5], [name6], [name7], [name8], [name9]) AS [name9]
|
Instead, what I got was this:
 |
 |
name1, name2, name3, name4, name5, name6, name7, name8, name9 AS [name4]
[name1], [name2], [name3], [name4], [name5], [name6], [name7], [name8], [name9] AS [[name4]]
([name1], [name2], [name3], [name4], [name5], [name6], [name7], [name8], [name9]) AS [[name4]]
|
Just out of curiosity, I've modified the snippet (removed the names_only part):
 |
 |
AS [$CURRENT(param1, dont_replace)$]
|
This produced a different, but similarly bad result for the above three lines:
 |
 |
name1, name2, name3, name4, name5, name6, name7, name8, name9 AS [,]
[name1], [name2], [name3], [name4], [name5], [name6], [name7], [name8], [name9] AS [,]
([name1], [name2], [name3], [name4], [name5], [name6], [name7], [name8], [name9]) AS [name7]
|
Any idea why this is happening?
|
|
Thu Oct 12, 2023 10:45 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
There was an enhancement added in 12.4 to enable more granular selection of what's in scope for current selection, like only letterrs, only numbers, and so on, but what I see in your examples is nothing like that and can't be explained. Please allow us some time to investigate.
|
|
Thu Oct 12, 2023 1:27 pm |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
Let me know if I can help in any way.
Meanwhile, I've got a few questions. What exactly is the difference in the new options? I've requested this feature enhancement and the reason behind it was that the snippet was originally using the "word" option and in case the caret was positioned like this (pipe indicates the cursor):
 |
 |
my_identifier_name|,
|
the option "word" had a rather unpleasant side effect of choosing the comma as 'victim' instead of going for 'my_identifier_name'.
 |
 |
my_identifier_name[,]|
|
This led me to change the snippet to use 'param1' which had its own issues, but at least it kinda worked. Until now. So now I changed it back to 'word' in the hope it would mean lower and uppercase letters, numbers, and the underscore (perhaps even the $ character if I'm lucky), which usually happen to be in words in the coding world, and it would exclude all the rest of the characters, symbols, like the brackets, operators and whatsoever. But it only went back to the old way of the macro not recognizing the identifier (actual word) right in front of its nose and again, it nailed the comma instead. After this, I tried changing it to "Letters+Digits" and it almost worked. Sadly, that's exactly what it says on the tin: letters and digits, underscore (and the $ definitely) not included. It tosses the comma "right" aside in situations like the above and leans towards the "left" instead, but as soon as it runs into an underscore, it slays the original identifier right there. The result:
 |
 |
my_identifier_[name]|,
|
Just out of curiosity, I've tried 'Symbols' but that one inserted the same $CURRENT(alphanumeric)$ into the snippet code just as "Letters+Digits" would. Are those two meant to be exactly the same?
|
|
Fri Oct 13, 2023 5:44 am |
|
 |
Mindflux
Joined: 25 May 2013 Posts: 846 Country: United States |
|
|
|
While this topic is being discussed, was the documentation for $CURRENT not updated to reflect these new options? I see the new options in the macro assistant but no mention in the documentation (pdf)
|
|
Fri Oct 13, 2023 10:32 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
We are testing a fix for the above issue. The user's guide update for new parameters added in 12.4 for $CURRENT$ is in progress and expected to be ready soon too.
|
|
Tue Oct 17, 2023 9:07 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
@gemisigo
Last week we emailed you a fix to test with your snippets dependent on the $CURRENT$. Please let us know if fixed know issues.
|
|
Mon Oct 23, 2023 4:12 pm |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
I'm sorry for the delay and thank you very much for the follow-up, I haven't noticed that email somehow ended up in the trash.
The fix is excellent!
|
|
Mon Oct 23, 2023 7:24 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Thank you so much for testing. Glad it's fixed. Emails with download links sometimes go straight to junk or other wrong folder, which is not uncommon. That's why we added a note here as well.
|
|
Mon Oct 23, 2023 8:31 pm |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|