hello Mosha,
thanks for implenting the timer, very useful. :D
I noticed that the parser respond diffrent on (round and squared) bracket errors.
I go a little bit into greater detail, break the problem into small parts and make a solution suggestion.
If i'm typing a mdx statement, sometimes the mdx studio shows me which bracket i close. So i think it knows when a part statement is closed.
It would be helpful if the parser tells me where i made a bracket error. Like in my first example, there is one bracket too much open in the with part. But mxd studio and MSSMS don't react. They both execute the statement and show an error in the column.
first example
| Code: |
WITH
MEMBER [Measures].[Measure1] AS [[DIM].[Hierarchy].CurrentMember.Name
SELECT
{ [Measures].[Amount], [Measures].[Measure1] } ON 0
,[DIM].[Hierarchy].ALLMEMBERS ON 1
FROM [Cube]
|
In the second example there is a wasted closed bracket in the with part. Mdx studio and MSSMS show me there is a problem in the select part.
second example
| Code: |
WITH
MEMBER [Measures].[Measure1] AS [DIM].[Hierarchy]].CurrentMember.Name
SELECT
{ [Measures].[Amount], [Measures].[Measure1] } ON 0
,[DIM].[Hierarchy].ALLMEMBERS ON 1
FROM [Cube]
|
In the third example there is a wasted open bracket in the select part. Mdx studio shows me exactly the right position of the error. But it don't see the reason for the error!
third example
| Code: |
WITH
MEMBER [Measures].[Measure1] AS [DIM].[Hierarchy].CurrentMember.Name
SELECT
{ [[Measures].[Amount], [Measures].[Measure1] } ON 0
,[DIM].[Hierarchy].ALLMEMBERS ON 1
FROM [Cube]
|
In the fourth and last example there is a wasted closed bracket in the select part. Mdx studio and MSSMS shows me there is an error at the "on".
fourth example
| Code: |
WITH
MEMBER [Measures].[Measure1] AS [DIM].[Hierarchy].CurrentMember.Name
SELECT
{ [Measures].[Amount], [Measures].[Measure1]] } ON 0
,[DIM].[Hierarchy].ALLMEMBERS ON 1
FROM [Cube]
|
Which the round bracket there are similar problems.
I understand that the parser can't be that intelligent like it knows where to close a bracket. But there could be small rules. I think you have them allready implemented and maybe you could expand them a little bit.
My suggestion would be a parser routine which
- first analyze if there is a bracket too much closed and shows the user the position - just a "small" counting routine
- second analyze if there is a bracket too much opend - you could count it on function words like you do it in the select part, but at the moment it doesn't work for the with part. There are the same possibilities. The round or squared brackets have to be closed until the next function word. You couldn't show the user the exact position. But for example if the with part is clean i have to look just on one part of the statement or the oposite. ;)
I think this two simple rules could reduce the searching anger with brackets inside big mdx statements.
Hope wasn't going to much in detail. :lol:
Is the code of the mdx studio open, so that i could maybe sometimes come up with a solution suggestion?
Greetings
MJ
PS: Mosha - your posting timestamp shows that you answering from the past (2007). Are you always ahead of the times (view from the past or behind view from today)? :D