03-04-2021 12:51 PM
Hi,
a German automotive customer has an issue running his scripts (that worked just fine up to DIAdem 2019). Since they upgraded to 2020 last week, most of their scripts seem broken. Even worse, DIAdem completely crashes.
After supporting them for a whole day, I found out one very strange issue with the IDX function, that seems to be the root cause.
They use IDX a lot to search for channels based on substrings. Their code looks somewhat like that:
If Idx("Searchstring","CN")>0 Then...
This works, as long as "Searchstring" equals a channel name. But if you'd look for "Searchstri" instead (which worked up to 2020), DIAdem now would freeze completely and must be killed via the Task Manager.
Even entering that phrase into the calculator (with the demo data set loaded) reproduces that crash.
Any idea about that?
BTW - Yes, I'm aware, that there are more elegant ways to address a channel (e.g. by using the Data object structure), but that will not make >50000 lines of legacy code work again.
Thanks,
Thomas.
Solved! Go to Solution.
03-10-2021 01:31 AM
Hello tpropst,
Thank you for this feedback. I can reproduce the problem you have described. It happens if you use IDX for searching in channels of the Dataportal. It works fine if you search in a vector variable like TV. Currently I assume that this problem because we have reworked the Dataportal which was necessary to support 150000 channels.
Below you find a workaround. You only need to add the function and to replace all IDX function with the new function call.
msgbox IDX_Portal("Temp")
function IDX_Portal(sSearch)
dim oGroups, oGroupChns
dim iGroup, iChn, iMaxChns
IDX_Portal = 0
if Data.GetChannels("*").Count > 0 then
set oGroups = Data.Root.ChannelGroups
for iGroup = 1 to oGroups.Count
set oGroupChns = oGroups(iGroup).Channels
iChn = 1
iMaxChns = oGroupChns.Count
do
if InStr(1, oGroupChns(iChn).Name, sSearch, vbTextCompare) > 0 then
IDX_Portal = oGroupChns(iChn).Properties("number").Value
else
iChn = iChn + 1
end if
loop until (IDX_Portal > 0) or (iChn > iMaxChns)
if IDX_Portal > 0 then exit for
next
end if
end function
We will try to fix this problem for the next DIAdem version.
Greetings
Walter
03-10-2021 01:49 AM - edited 03-10-2021 01:52 AM
Dear Walter,
thanks for your prompt response and suggestion for a workaround.
The customer will stay with v2019 for some time now and wait for a possible bugfix in the next version(s). They don't want to touch all their scripts.
Their new scripts won't use that function anymore, but will be using the data object.
Best regards,
Thomas.
03-10-2021 01:59 AM
Hi Tomas,
Thank you for the update. Regarding already existing scripts (as well as new scripts) I would like to point to the installed DIAdem example: “Searching for Obsolete Commands and Variables”. This can be used to scan scripts, SUDs and REPORT layouts for old variables and commands which are declared as obsolete.
Greetings
Walter