DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Channel selection in DataPortal after script ends

Solved!
Go to solution

Hi

At the beginning of my script, i select a channel in the data portal (structure view). At the end of the script, the channel should be selected again an it should be visible in the data portal.

When i run my script in debug mode, it works. But if I run it in "normal mode", I always end up at the top of the data portal with no channel selected.

 

Has anyone an idea how i can change this behavior?

 

Regards Werner

 

 

0 Kudos
Message 1 of 6
(2,812 Views)

   Hi Siipo,

 

Have you tried using the "record" scripting tool and compare with what you have done?

 

Have a nice day,

M-Junior

0 Kudos
Message 2 of 6
(2,778 Views)

Hi Siipo,

This code works on my DIAdem 2017:

dim oChn, oGroup
set oGroup = Data.Root.ChannelGroups(1)
set oChn   = oGroup.Channels(2)
call Portal.Structure.Selection.RemoveAll
if not Portal.Structure.IsExpanded(oGroup) then
  Portal.Structure.Expand(oGroup)
end if
call Portal.Structure.Selection.Add(oChn)

Greetings

Walter

0 Kudos
Message 3 of 6
(2,762 Views)

Hi,

 

thanks for your code. I tried it and if i put just your code in a nem sheet, it works, but if i copy your code in to my script, i end with the target group open, but on the top of teh data portal and no channel selected. if i run it in debug mode, it works fine.

 

Code:

 

Option Explicit 
autoabort = true
dim oChn, oGroup

T2 = "[1]" ' Kanalname
T1 = "free offset" ' Ogffset typ
R1 = 3  ' offset-Wert
T2 = Portal.Structure.Selection(1).GetReference(eRefTypeIndexName) ' [Gruppenindex]/Kanalname


If SudDlgShow("Dlg1",AutoActPath &"Offset_Dialog.SUD") = "IDOk" Then
Else
  Call MsgBoxDisp("DIAdem hat das Script abgebrochen.","MB_NOBUTTON","MsgTypeNote",,2)
  err.Raise -1
  err.Clear
End If


R4 = InStr(T2, "/")
R5 = Len(T2)
T3 = Mid(T2, (R4+1), R5)

R4 = InStr(T2, "[")                  
R5 = InStr(T2, "]")
'call MSGBOXdisp(""&R4&"//"&R5&"")
T4 = Mid(T2, (R4+1), (R5-R4-1))

R3 = Val(T4)

R2 = Data.Root.ChannelGroups(R3).Channels(T3).Properties("groupindex").Value
Call ChnOffset(""&T2&"",""&T2&"",R1,""&T1&"")
Call Portal.Structure.Selection.RemoveAll

set oGroup = Data.Root.ChannelGroups(R3)
set oChn   = oGroup.Channels(R2)

if not Portal.Structure.IsExpanded(oGroup) then
  Portal.Structure.Expand(oGroup)
end if
call Portal.Structure.Selection.Add(oChn)

 

 

0 Kudos
Message 4 of 6
(2,758 Views)
Solution
Accepted by topic author siipo

Hi siipo,

You're right. I've forgotten the (special) Portal refresh before my code.

call UIAutoRefreshSet(true)
call UIAutoRefreshSet(false)
set oGroup = Data.Root.ChannelGroups()
set oChn   = oGroup.Channels()
if not Portal.Structure.IsExpanded(oGroup) then
  Portal.Structure.Expand(oGroup)
end if
call Portal.Structure.Selection.Add(oChn)

By the way, you use the standard variables R1, R2, R3 ... as index. The R stands for real, but an index expects integer values. It would be better to use L1, L2, L3 ... for an index.

 

Greetings

Walter

0 Kudos
Message 5 of 6
(2,756 Views)

Now it works

 

thanks

0 Kudos
Message 6 of 6
(2,754 Views)