Home » Developer & Programmer » Forms » LIST ITEM
LIST ITEM [message #661615] Sat, 25 March 2017 02:01 Go to next message
sr8464
Messages: 82
Registered: February 2017
Location: India
Member
DECLARE
	CURSOR GRP2 IS
	SELECT ROWNUM RN2, MODULE_MAST.MODULE_CODE||' - '||MODULE_NAME MODULE
	FROM MODULE_MAST, USER_MAST WHERE :LOGIN_USER_CODE = USER_MAST.USER_CODE
	AND :LOGIN_PASSWORD = USER_MAST.PASSWORD;
BEGIN
	CLEAR_LIST ('LOGIN_MODULE_LIST');
	FOR I2 IN GRP2 LOOP
		ADD_LIST_ELEMENT ('LOGIN_MODULE_LIST', I2.RN2, I2.MODULE, I2.MODULE);
	END LOOP;
END;
WORKS FINE
BUT I WANT LIST ITEM AUTO SELECT 1ST VALUE/ ITEM
Re: LIST ITEM [message #661636 is a reply to message #661615] Sat, 25 March 2017 13:05 Go to previous messageGo to next message
Littlefoot
Messages: 21562
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
The way you wrote the SELECT statement, you can't know which value will be the first as there's no ORDER BY clause there.

Once you fix it, you'll have to use the same query in one of triggers (such as WHEN-NEW-ITEM-INSTANCE, or WHEN-CREATE-RECORD, or WHEN-NEW-FORM-INSTANCE, or similar) and set the initial value of that item to a desired value. I can't check it myself, but I think that you can't do it in item's Property Palette; there is the "Initial value" property and I know it accepts a constant (such as "1" or "New York"), but I don't know whether you can put a query in there. Though, you can easily check it yourself.
Re: LIST ITEM [message #661780 is a reply to message #661636] Sat, 01 April 2017 11:06 Go to previous messageGo to next message
sr8464
Messages: 82
Registered: February 2017
Location: India
Member
i cant set initial value for that because of in item_list value changes using where clause for different user different value

i want some like.. set item value script set default value for current user
Re: LIST ITEM [message #661784 is a reply to message #661780] Sat, 01 April 2017 13:50 Go to previous messageGo to next message
Littlefoot
Messages: 21562
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I think I told you how to do that; I didn't change my mind.
Re: LIST ITEM [message #661811 is a reply to message #661784] Mon, 03 April 2017 12:56 Go to previous messageGo to next message
sr8464
Messages: 82
Registered: February 2017
Location: India
Member
CREATE TABLE ENTITY_MAST(
ENTITY_CODE VARCHAR(2) NOT NULL,
ENTITY_NAME VARCHAR(50));
INSERT INTO ENTITY_MAST VALUES ('SR','SR INFO SOLUTION');
INSERT INTO ENTITY_MAST VALUES ('DP','DIGITAL PLANET');
INSERT INTO ENTITY_MAST VALUES ('XP','XEROX POINT');
BEGIN
DECLARE
	RG_LIST_ID RECORDGROUP;
	RG_NAME VARCHAR (20) := 'RG_LIST';
	RET_CODE NUMBER;
	V_SELECT VARCHAR (60);
	BEGIN
   V_SELECT := 'SELECT ENTITY_NAME, ENTITY_NAME FROM ENTITY_MAST ORDER BY 1';
   RG_LIST_ID := FIND_GROUP (RG_NAME);
   IF NOT ID_NULL (RG_LIST_ID)
   	THEN
   	DELETE_GROUP (RG_LIST_ID);
   END IF;
   RG_LIST_ID := CREATE_GROUP_FROM_QUERY (RG_NAME, V_SELECT);
   RET_CODE := POPULATE_GROUP (RG_LIST_ID);
   POPULATE_LIST ('LOGIN_ENTITY_LIST','RG_LIST');
   DELETE_GROUP (RG_LIST_ID);
	END;
END;
SET_ITEM_PROPERTY('LOGIN_ENTITY_LIST',INITIAL_VALUE,'XEROX POINT');
showing error
FRM-41042 No such property for Set_item_property.
Re: LIST ITEM [message #661812 is a reply to message #661811] Mon, 03 April 2017 13:48 Go to previous messageGo to next message
Littlefoot
Messages: 21562
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Contact Oracle and make them make your wish come true, i.e. ask them to include the INITIAL_VALUE property into one of future Forms versions. Because, it doesn't exist in the current SET_ITEM_PROPERTY incarnation.

Now, seriously: you can't use non-existent properties. Open Forms Help and search for SET_ITEM_PROPERTY; help topic lists all valid properties (INITIAL_VALUES isn't one of them).

I don't see any reason for you to use such a complex code for such a simple thing. All you need is only one line:
:login_entity_list := 'XEROX POINT';

In one of your previous message you mentioned a WHERE clause, but I don't see any in code you posted. Besides, it is much simpler to create a Record Group directly in Object navigator (under the "Record Group" node), specify SELECT statement (include WHERE clause you mentioned). Then base List of Values on that Record Group. LoV's work quite well; don't make your life more complicated than it deserves.
Re: LIST ITEM [message #661829 is a reply to message #661812] Mon, 03 April 2017 23:54 Go to previous message
sr8464
Messages: 82
Registered: February 2017
Location: India
Member
That's what I should have to do. Thanks...
Previous Topic: (select count(*) from table) > 0 then
Next Topic: Oracle Form application deployment
Goto Forum:
  


Current Time: Mon Jun 01 21:40:36 CDT 2020