Re: arr_count, set_count help needed
Posted in 1996
mrh@panix.com (Michael Hoffman) wrote: :Using Informix 4.* and programming in 4gl, I have run into a couple of :problems and am looking to some gurus for assistance. :These problems all deal with the use of "SET_COUNT" and "ARR_CURR". What :variables do these functions report on? How can we update them on the fly? :[Also, unrelated, If an "On Key" will cause Informix to bypass the key's normal :function, then how can we call what it normally does? I.e. -- "On Key (Up)" :should normally take you to the next record. If want to turn this function :off at certain times, depending on array element features, how can I test the :array (I know... an IF statement) and then tell Informix to get Next record :depending on the results???] May be you can leave the input array, reenter it and then move to the appropriate record via the system described in the FAQ for this? :Here are the issues: :1) I have a "Display Array". I would like to be able to insert records and :delete records from this array. My work-around is to close the array, perform :the array adjustments, and then re-open the Display with a new "set_count" call :informing it of the new number of array elements. However, this will position :the internal Diaply Array cursor at the first array element. I would like to :reposition this cursor to the array position where the modification took place. :This means adjusting the ARR_CURR variable. How? I have allways used input array (never display array) and this function is automatically available via the insert and delete keys. When I realy need the display array functionallity (nothing the user can change) I use noentry fields only except for one single character field at the left. You sadly can't adjust the ARR_CURR variable. There is a vay of moving to a spesific row using input array described in the FAQ, but I don't know any way of doing it with a display array. :2) I have an Input array. The user decides to Insert a row into the middle of :the array, but then decides they don't really want it. They NULL out 2 :important fields, and I check for this. I get rid of the empty row :(array[x].*=array[x+1].* through the rest of the array), and NULL out the :final record. However, Informix looks at this last record as a NULL record in :the array because it's "SET_COUNT" variable was automatically incremented. How :can I decrement this variable (without closing and re-opening the Input Array) :so Informix looks at only the true existing elements of the array? This problem also appears if the user ever moves beyond the last row with data (and don't key anything in there). For this reason we allways check the array after an input starting at the end for all null values and adjust the number of rows we use accordingly. There is then no need to decrement the count. Also there is no way to do it while you are inside the input array statement. If you absolutly must decrement it you have to leave the input array and reenter it, probably using the system described in the FAQ to return the cursor to the proper position in the array. Otherwise why don't you let the user use the delete key instead. That takes care of all counts. :3) I have an Input Array. I am inserting a row and hit the "NextPage" Key. :This causes Informix to bypass the After Insert and After Row sections. How :can I stop this? We test in every after field for the fgl_lastkey value to handle this and some other situations (moving the cursor arround and displaying things with different attributes). :4) In the After Row section, I do some testing of the fields. If they fail, I :say "Next Field [x]", but Informix puts me in [x] in the NEXT RECORD! How can :I tell Informix to stay on the current record? This is a known bug that was fixed in some version of 4GL. (I don't remember the version number but check with Informix if noone else posts it.) I know of no way to get arround it other than upgrading (except if you want to do some very fancy stuff using the system described in the FAQ again, leave the input array and reenter it moving to the correct row). :That's all for now. Thanks for whatever help you can give me! Nils.Myklebust@idg.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company The Informix FAQ is at http://www.iiug.org