cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
xiongtao001
Level 2

When Convert a NUMBERLIST to STRINGLIST by ListConvertNumToStr, the items will lost

When Convert a NUMBERLIST to STRINGLIST by ListConvertNumToStr, the items will lost

My program:

// Included header files ----------------------------------------------------
#include "ifx.h"
#define LNUMLIST_FILE "C:\\LNUMLIST_FILE.lst"
#define LNUMLISTADDLIST_FILE "C:\\LNUMLISTADDLIST_FILE.lst"

function OnFirstUIBefore()
STRING szMsgPar;
begin
szMsgPar = "Steven";
MessageBox(szMsgPar, WARNING);
end;

function OnMaintUIBefore()
LIST lNumList;
//LIST lNumListAddList;
LIST lStringList;
NUMBER nListCount, i, nvItem;
NUMBER nListType;
STRING svListCount, sListType, sItem, svString;

begin
//Create NUMERLIST and add Items for the NUMBERLIST
lNumList = ListCreate(NUMBERLIST);
ListAddItem(lNumList,117,AFTER);

//Get current item and conver it to string by function - NumToStr
//CheckPoint1: Expected Result: Messagebox: The Item: 117
ListCurrentItem(lNumList, nvItem);
NumToStr(sItem, nvItem);
MessageBox("The Item:" + sItem, INFORMATION);

//Initialize the STRINGLIST
lStringList = ListCreate(STRINGLIST);

//Convert the NUMBERLIST-lNumList to STRINGLIST-lStringList by function ListConvertNumToStr
//CheckPoint2: Expected Result: MessageBox: ISERR_SUCCESS
if (ListConvertNumToStr(lNumList, lStringList)) >= ISERR_SUCCESS then
MessageBox("ISERR_SUCCESS", INFORMATION);
else
MessageBox("ListConvertNumToStr FAILED", SEVERE);
endif;

//Get the value of First string of STRINGLIST-lStringList
//CheckPoint3: Expected Result: MessageBox:The Current String Value:117
ListGetFirstString(lStringList, svString);
MessageBox("The Current String Value:" + svString, INFORMATION);

//Count the STRINGs num of STRINGLIST-lStringList
//CheckPoint4: Expect Result: MessageBox: svListCount:1
nListCount = ListCount(lStringList);
NumToStr(svListCount, nListCount);
MessageBox("svListCount:" + svListCount, INFORMATION);


end;


Actual Result:
CheckPoint1: MessageBox display - "The Item:117"
CheckPoint2: MessageBox display - "ISERR - SUCCESS"
CheckPoint3: MessageBox display - "The Current String Value:"
CheckPoint4: MessageBox display - "svListCount:0"

CheckPoint3 and CheckPoint4 were not meet my expected result, why?
Labels (1)
0 Kudos
(1) Reply
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

It appears that the documentation for ListConvertNumToStr has the parameters for the function definition reversed. The correct function definition should be:
ListConvertNumToStr(listString, listNumber);

Please try reversing the parameters you are passing to try resolving this issue.

I have submitted a work order regarding this documentation issue.
0 Kudos