The problem you have with this (old) code is probably because you don't call it from the VISU_TASK. With the TestListUtils library function this is not necessary.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I am running this code to grab text from an Alarm Config Text List so that I can send the same text in an Email:
(Program)
AlarmID := GetText(sID := GVL.sAlarmID, sTextList := TextList);
AlarmMessage := VisuElems.cmpDynamictext.DynamicTextGetDefaultText(ADR(TextList), ADR(GVL.sAlarmID))^;
(Function)
GetText := VisuElems.CmpDynamicText.DynamicTextGetText(pstTextList:=ADR(sTextList),pstTextIndex:=ADR(sID))^;
My problem is that it seems sometimes (and only sometimes) I end up with a watchdog fault which points to the GetText Functions. Any ideas why?
Thanks.
You should use the TextListUtils library for this which already has a GetText function. See https://faq.codesys.com/display/CDSFAQ/Access+to+Text+Lists+from+the+IEC+Code
The problem you have with this (old) code is probably because you don't call it from the VISU_TASK. With the TestListUtils library function this is not necessary.
Thank you so much timvh, you have helped me a lot!