Friends, I am trying to write some code to create a Dialog Box where the Choice box needs to store the previously entered as choice element, just like the filter in the module, where you can see in the filter defination tab, at Value choice box. I have tried to populate the array dynamically but getting run time error. trying like below ------------------------ string fListArray[] = {} int fValIndex = 0
void fValueHandler(DBE xChioce) {
fValue = choice(MainDB, "", fListArray, 0, 50, true) -------------------------------------- Other issue i have noticed the control is not even going to fValueHandler function, i amy be wrogn with set, I am new to DXL, Please give me your suggestions and help me, I really appreciate your help, as I have to deliver the code, and strugling for days so far. Thanks in advance, Saladi RSaladi - Mon Sep 08 10:56:29 EDT 2014 |
Re: Populating array elements in string array which is used for Choice DBE Hi, it depends a little on the situation you have: a) At the time of creation of the choice element, you already know the values it will have. In this case, you just declare a string array with the right size and put the values to it. If you need to calculate all values and you do not know how many you will have, you fist add them to a skip list and then make an array of the skip list. Skip fListString = create() int fValIndex = 0 // this approach is valid if you can calculate the // contents of your choice element at the start but you do not know how many // elements you will have. // calculate all values here ... for value ... { put (fListString, fValIndex, value) fValIndex++ } string fListArray[fValIndex]; // declare an array large enough to hold all elements int i; for (i = 0; i < fValIndex;i++) { string s = null; find(fListString, i, s) // get value from skip list fListArray[i] = s // fill the arrayy ... } // We initialize our choice with the calculated values fValue = choice(MainDB, "", fListArray, 0, 50, true) b) You do not know the values that the choice element will have at the time of creation. In this case you use an empty array and use the insert(...) perms to add content to the choice element dynamically. Just use the forum search - I am sure you will find multiple examples ... Maybe this helps, regards, Mathias |
Re: Populating array elements in string array which is used for Choice DBE Mathias Mamsch - Mon Sep 08 11:39:03 EDT 2014 Hi, it depends a little on the situation you have: a) At the time of creation of the choice element, you already know the values it will have. In this case, you just declare a string array with the right size and put the values to it. If you need to calculate all values and you do not know how many you will have, you fist add them to a skip list and then make an array of the skip list. Skip fListString = create() int fValIndex = 0 // this approach is valid if you can calculate the // contents of your choice element at the start but you do not know how many // elements you will have. // calculate all values here ... for value ... { put (fListString, fValIndex, value) fValIndex++ } string fListArray[fValIndex]; // declare an array large enough to hold all elements int i; for (i = 0; i < fValIndex;i++) { string s = null; find(fListString, i, s) // get value from skip list fListArray[i] = s // fill the arrayy ... } // We initialize our choice with the calculated values fValue = choice(MainDB, "", fListArray, 0, 50, true) b) You do not know the values that the choice element will have at the time of creation. In this case you use an empty array and use the insert(...) perms to add content to the choice element dynamically. Just use the forum search - I am sure you will find multiple examples ... Maybe this helps, regards, Mathias Thank you Mathias for the Idea, I have used it partially to solve my problem. I have used set function to update the Array with dynamic values (ofcourse the array is not dynamic, but fixed length with null values), now I am able to see the list with dynamically updated values. i appreciate your help in this forum. -Saladi |