Hello, I am trying to write a dxl script which takes integer array (Absolute Numbers of DOORS) that entered into a dialog box and modifies a particular attribute of that object for each Absolute Number.
Module m = current
load view "Some View"
Object ob
int a[]={1281, 1280, 1282, 748, 189, 134, 2234, 232, 234,235, 236, 237, 238,
239, 2226, 240, 241, 1330, 1331, 1332, 242, 243, 1333, 1334, 1335, 244, 245,
246, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 256, 266, 260, 261, 262,
263, 264, 265, 744, 266, 745, 2004, 267, 268, 1962, 316, 2277}
int i
for i in 0:((sizeof a)-1) do
{
ob = object(a[i], m)
ob."Some Status" = "Something Complete"
}
I want dxl to take integer array a[] from a dialog box, and when I press OK button, then 'Some Status' attribute shall be filled with "Something Complete" for those objects IDs of array a. Any help will be greatly appreciated.
Thanks in advance Ashok Anumula ashokanumula - Thu Nov 09 06:42:40 EST 2017 |
Re: How to store integer array in dialog box Hello Ashok,
Well, one idea would be to take the string "1281, .... 227" from the dialog box, enclose it with "int a[] ={" and "}" and use the trick mentioned in https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014873958 to read the array, but I think it would be way easier to parse the string. EIther like this https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014959868 or with one of the methods mentioned in https://stackoverflow.com/questions/1043604/string-split-in-dxl or write your own code that goes through the string characterwise and collect all digits in a string. Whenever the next character is not a string, you have a number and can use "intOf (stringvariable)" to get the number and push it to your array.
|
Re: How to store integer array in dialog box Mike.Scharnow - Thu Nov 09 07:49:53 EST 2017 Hello Ashok,
Well, one idea would be to take the string "1281, .... 227" from the dialog box, enclose it with "int a[] ={" and "}" and use the trick mentioned in https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014873958 to read the array, but I think it would be way easier to parse the string. EIther like this https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014959868 or with one of the methods mentioned in https://stackoverflow.com/questions/1043604/string-split-in-dxl or write your own code that goes through the string characterwise and collect all digits in a string. Whenever the next character is not a string, you have a number and can use "intOf (stringvariable)" to get the number and push it to your array.
Thanks for reply Mike.
DB splitBox = create "Text splitter"
DBE objTextElem = text(splitBox, "Object text:", string ot = get objTextElem
print ot
} // getSelection
print ot is printing below string
2140 I want a dxl code to convert each number string into number integer and use further If I get dxl code direclty, it will be great Mike.
Thanks, Ashok |
Re: How to store integer array in dialog box ashokanumula - Thu Nov 09 09:17:50 EST 2017 Thanks for reply Mike.
DB splitBox = create "Text splitter"
DBE objTextElem = text(splitBox, "Object text:", string ot = get objTextElem
print ot
} // getSelection
print ot is printing below string
2140 I want a dxl code to convert each number string into number integer and use further If I get dxl code direclty, it will be great Mike.
Thanks, Ashok Hi Ashok, sorry, I don't have a function for this in my library and don't have the time to program it, but the links I sent contain enough code to reuse and to get you started |
Re: How to store integer array in dialog box Mike.Scharnow - Thu Nov 09 11:40:04 EST 2017 Hi Ashok, sorry, I don't have a function for this in my library and don't have the time to program it, but the links I sent contain enough code to reuse and to get you started Hi Mike, Finally I developed the dxl script, it is working fine. Thanks a lot for your help ================================================================ DB splitBox = create "Text splitter"
DBE objTextElem = text(splitBox, "Object text:",
string ot = get objTextElem int str_index
void str_split(string splitter, string str, Skip fileLines) buf = "";
for(str_index = 0; str_index < length(str); str_index++)
string str
for str in fileLines do
ob = object(intOf(str), m) }
delete fileLines ===========================================================
|
Re: How to store integer array in dialog box ashokanumula - Fri Nov 10 06:56:51 EST 2017 Hi Mike, Finally I developed the dxl script, it is working fine. Thanks a lot for your help ================================================================ DB splitBox = create "Text splitter"
DBE objTextElem = text(splitBox, "Object text:",
string ot = get objTextElem int str_index
void str_split(string splitter, string str, Skip fileLines) buf = "";
for(str_index = 0; str_index < length(str); str_index++)
string str
for str in fileLines do
ob = object(intOf(str), m) }
delete fileLines ===========================================================
Great. Thanks for the update! |