This has been going on for some time (but was too busy to post about it...). It could be a mistake on my side, but am not able to discover what it is.
I have several VB scripts (functions) to control item colors or other fields, and these scripts fail to work when certain characters are used in fields used as function parameters.
Explanations :
1- Some problematic chars
"
Line Break ("shift-enter")
new paragraph
2- example of function that will fail to work when the above mentioned characters are used:
'This function's use is to fill a field with info based on some parameters using other fields data ( "Note" and "Ordre").
Function NomActe (Item, Notes, Ordre, TitreActe)
if Item = "Acte" then
NomActe = ordre & " " & Notes
else NomActe = TitreActe
end if
End Function
if Item = "Acte" then
NomActe = ordre & " " & Notes
else NomActe = TitreActe
end if
End Function
Applications:
1- Create a text field, with inheritance ON, called "PA_TitreActe", with this equation :
=NomActe(Item, Notes, ordre, PA_TitreActe)
2- create a text field called "ordre"
3- create a new VB Script
Function NomActe (Item, Notes, Ordre, TitreActe)
if Item = "Acte" then
NomActe = ordre & " " & Notes
else NomActe = TitreActe
end if
End Function
if Item = "Acte" then
NomActe = ordre & " " & Notes
else NomActe = TitreActe
end if
End Function
4- In a grid, create an item with :
item = Acte
notes = this is the note for the test item
ordre = a
5- The PA_TitreActe of this new item should now have in it : a this is the note for the test item
6- Create a subitem of the "Acte" item with :
item = test
7- Because of inheritance, he PA_TitreActe field of the "test" subitem should now have in it : a this is the note for the test item
8- Now modifythe "test" subitem "item" field to : test 2
and vb script will worlk ( the "PA_TitreActe" field of the test item should remain the same ( a this is the note for the test item ) )
9- But if you modify the "test" item "item" field to : test "2"
and the vb script will fail to work : the "PA_TitreActe" field of the test "2" item will be erased
This is a very ennoying issue (bug?) as I use the " character quite a lot, and the "line break" or new paragraph too.... and this affects almost all my vb scripts.
Any suggestions ? Anybody else with this problem ?
Comments