Bex wrote:
ZvezdanD!
This is indeed a very good enhancement to MN which deserves attention. Pablo seems to be busy and havent been on the forums for quite a while now.
Can you please post your modified script here so other could use it as well?
/Bex
Hi Bex,
Thank you for your interesting about my modification of MN. There is many lines of code which I added/modified, so I sent whole script to Pablo immediately after my first post in this forum. Pablo said to me that he is currently busy, but: "in a couple of weeks at most I'll resume working on the script and I'll add your changes."
Well, I can post here my modified script, but I am not sure if it is right to Pablo, especially because he is modified last version of script also. Anyway, I can give you a little guide to my modifications.
First, less modification is inside of SkinnedInputBox function, because I had a strange dialog box (Create Magic Node or Edit Magic Node) without OK and Cancel buttons. Well, this buttons exists, but they are truncated, outside of visible area of form. I think that main reason for this behavior is place of line:
Code: Select all
Form.SavePositionName = "Remember position"
I moved that line after all created controls on that form in mentioned function, and after that everything is OK.
Next modifications are inside of FillCustomNode subroutine, because of "The" and similar prefixes. Here is a part of this subroutine:
Code: Select all
' ZvezdanD: Start of first added lines
If IgnoreArticleDict.Exists(FldTxt) Then
Dim aIgnore, sTmp, i
If SDB.IniFile.BoolValue("Options", "IgnoreTHEs") Then
aIgnore = Split(SDB.IniFile.StringValue("Options", "IgnoreTHEStrings"), ",")
Else
aIgnore = Articles
End If
OrderField = ""
For i = 0 To UBound(aIgnore)
sTmp = UCase(Trim(aIgnore(i)))
OrderField = OrderField & "Ucase(Left(" & Field & ", " & Len(sTmp) + 1 & ")) = '" & sTmp & " ', " & Len(sTmp) + 2 & ", "
Next
If Len(OrderField) = 0 Then
OrderField = Field
Else
OrderField = "Mid(" & Field & ", Switch(" & OrderField & "True, 1))"
End If
If trimValue > 0 Then Field = OrderField
End If
' ZvezdanD: End of first modification
If Not trimField Then
' Do nothing
ElseIf trimValue > 0 Then
Field = "Left(" & Field & "," & trimValue & ")"
ElseIf trimValue < 0 Then
Field = "Right(" & Field & "," & (-trimValue) & ")"
ElseIf leftOfValue <> "" Then
Field = "Left(" & Field & ", InStr(" & Field & ", '" & leftOfValue & "'))"
ElseIf rightOfValue <> "" Then
Field = "Right(" & Field & ", Len(" & Field & ")-InStr(" & Field & ", '" & rightOfValue & "'))"
End If
' Set several parameters according to whether an index field has been defined
If IdFieldDict.Exists(FldTxt) And Not trimField Then
IdField = IdFieldDict.item(FldTxt)
ContentIndex = 1
Else
IdField = Field
ContentIndex = 0
End If
' Deal with the sort field specified by the user
SortCondition = getQualifierValue(curLevelMask, "sort by", "", False)
'Determine how to order type
' ZvezdanD: Start of second modification
If SortCondition <> "" Then
OrderType = otOrderByAggregate
OrderField = " IIF(Min(" & getSQLSortField(SortCondition) & ")<0, -1, " & getSQLSortFieldCondition(SortCondition) & ") "
ElseIf IgnoreArticleDict.Exists(FldTxt) Then
OrderType = otOrderByIgnoreArticle
If trimValue > 0 Then OrderField = Field
Else
OrderType = otOrderByField
OrderField = Field
End If
' ZvezdanD: End of modificatons
ORDER_BY_Clause = " ORDER BY " & OrderField & " " & getQualifierValue(curLevelMask, "sort order", "ASC", False) _
& Cond(OrderType <> otOrderByField, ", " & Field, "")
'Deal with known/unknown fields
As you can see, there are two possibilities for reading prefixes: first is from MM ini file (there is IgnoreTHEs key which corresponds to the option in Options dialog box), and second is on the beginning from same MN script. I did like that because I don't know from which MM version that IgnoreTHEs option exists.
Because of that, I changed subscript from 1 to 0 in next lines on script begin:
Code: Select all
Dim Articles(0)
Articles(0) = "The"
I am sorry, but English is not my mother language. Maybe this is all confusing, but I think you should wait to Pablo next release of his script.