How to read the content of a text list from the IEC code?
Motion Control Forum
Schneider Electric forum for Motion Control solutions, including Lexium MC12 & Cobot, Modicon PLC, PacDrive, Ecostruxure Machine, … from design, implementation to troubleshooting and more
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send InviteCancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-04-2310:29 PM
How to read the content of a text list from the IEC code?
This feature requires the WebVisu object (VISU_TASK) and the library TextListUtils to execute the relevant functions.
The example code shown below, needs to be executed in a low priority task with long cycle time (e.g. prio 25 and 500ms cycle time) to avoid performance issues. Depending on the selected variable values udiLanguage, sID and sTextList the selected text list content will be returned by the function LTU.ReturnValues.
PROGRAM Get_Text_from_Textlist
VAR
udiLanguage :UDINT :=1;
sID :STRING :='1';
sTextList :STRING :='TextList1';
wsResult :WSTRING;
retVal :TLU.ReturnValues;
END_VAR
CASE udiLanguage OF
0: //Default - English
CmpDynamicText.DynamicTextChangeLanguage(stLanguage := 'Default');
1: //German
CmpDynamicText.DynamicTextChangeLanguage(stLanguage := 'de');
2: //French
CmpDynamicText.DynamicTextChangeLanguage(stLanguage := 'fr');
END_CASE:
retVal:=TLU.GetTextW(pwsText := ADR(wsResult), diSize := SIZEOF(wsResult), sTextList := sTextList, sTextIndex:=sID);