Skip to main content

Hello,

 

Has anyone created new entity with sequence in IFS Developer Studio ? 

I want to create sequence for keys of my table.

I could create index and sequences in PLSQL Developer but i guess it is made in .storage file in Developer Studio.

How can I create .storage file of the entity to define INDEX or SEQUENCE ?  

Or maybe i need another way to define them. Could anyone please help ?

 

Thanks & Best Regards

Hi @cilik,

I normally use the following approach if it's a new entity with a sequence as the key.

.entity file,

attributes {
key LineSeq NUMBER K---L;
public LineNo NUMBER AMI-L;
}


.storage file,

-------------------- OTHER DEFINITIONS --------------------------------------

SEQUENCE C_NEW_ENTITY_LINE_SEQ IS MINVALUE 1 START WITH 1 INCREMENT BY 1 NOCACHE ORDER;


INDEX C_NEW_ENTITY_IX1 IS C_NEW_ENTITY_TAB (line_no);


.plsql file,

-------------------- LU SPECIFIC IMPLEMENTATION METHODS ---------------------

@Override
PROCEDURE Insert___ (
objid_ OUT VARCHAR2,
objversion_ OUT VARCHAR2,
newrec_ IN OUT c_new_entity_tab%ROWTYPE,
attr_ IN OUT VARCHAR2 )
IS
BEGIN
newrec_.line_seq := C_NEW_ENTITY_LINE_SEQ.NEXTVAL;

Client_SYS.Add_To_Attr('LINE_SEQ', newrec_.line_seq, attr_);

super(objid_, objversion_, newrec_, attr_);
END Insert___;


Note the following codes segments in the generated .cre file with corresponding to the SEQUENCE and the INDEX added in the .storage file.
Make sure that you add them all when creating the .cdb file.

-----------------------------------------------------------------------------
-------------------- SEQUENCE DEFINITIONS -----------------------------------
-----------------------------------------------------------------------------

-- [IFS COMPLETE BLOCK DECLAREEND]
DECLARE
sequence_name_ VARCHAR2(30) := 'C_NEW_ENTITY_LINE_SEQ';
BEGIN
Database_SYS.Create_Sequence(sequence_name_, 'MINVALUE 1 START WITH 1 INCREMENT BY 1 NOCACHE ORDER', TRUE);
END;
-- [END IFS COMPLETE BLOCK]
/


-----------------------------------------------------------------------------
-------------------- INDEX DEFINITIONS --------------------------------------
-----------------------------------------------------------------------------

-- [IFS COMPLETE BLOCK DECLAREEND]
DECLARE
index_name_ VARCHAR2(30) := 'C_NEW_ENTITY_IX1';
table_name_ VARCHAR2(30) := 'C_NEW_ENTITY_TAB';
columns_ Database_SYS.ColumnTabType;
BEGIN
Database_SYS.Reset_Column_Table(columns_);
Database_SYS.Set_Table_Column(columns_, 'LINE_NO');
Database_SYS.Create_Index(table_name_, index_name_, columns_, 'N', '&IFSAPP_INDEX', NULL, TRUE, TRUE);
END;
-- [END IFS COMPLETE BLOCK]
/

 

Cheers !
Dhananjaya.


Thank you for your helpful answer.

Best Regards.


Thank you for your helpful answer.

Best Regards.

Hi @cilik,

You are welcome and I'm happy to help 😊

Cheers !
Dhananjaya.