5 Replies Latest reply: May 9, 2014 9:11 AM by CraigB RSS

    Form10g  field validation

    me_zeeshan

      My Form one field out put is

       

      SHIFT

      ----------

      A

      A

      B

      B

      C

       

      I want validation like when i do update/change   any things from this above said  it should be a single character and that should be either 'A' OR 'B' 'C' and should be uppercase any help plz

      wr

      zeeshan

        • 1. Re: Form10g  field validation
          Paul M.
          I want validation like when i do update/change   any things from this above said  it should be a single character and that should be either 'A' OR 'B' 'C' and should be uppercase

          Maybe I don't understand you correctly, because it looks too simple to me... anyway...

          Maximum length              1

          Fixed length                Yes

          Lowest allowable value      A

          Highest allowable value     C

          • 2. Re: Form10g  field validation
            Soofi

            Hi zeeshan,

            Need some  more details...

            Please explain with your process, if possible clarify us with a table script.

             

             

            Regards,

            Soofi

            • 3. Re: Form10g  field validation
              me_zeeshan

              SHIFT_ID SHIFT_DATE  SHIFT   EMP_ID

              200     10-MAY-2014   A         10

              201     11-MAY-2014   A         10

              202     12-MAY-2014   B         10

              203     13-MAY-2014   A         10

               

              This record  i fetching through using pl/sql record

              TYPE shift_rec is RECORD(

              SHIFT_ID       WEB_HR.HR_SHIFT.SHIFT_ID%TYPE,   

              EMP_ID           WEB_HR.HR_SHIFT.EMP_ID%TYPE,    

              SHIFT_DATE       WEB_HR.HR_SHIFT.SHIFT_DATE%TYPE,

              DELFLAG           WEB_HR.HR_SHIFT.DELFLAG%TYPE,   

              COMPANYCODE        WEB_HR.HR_SHIFT.COMPANYCODE%TYPE,

              ENTRYDATE          WEB_HR.HR_SHIFT.ENTRYDATE%TYPE, 

              SHIFT           WEB_HR.HR_SHIFT.SHIFT%TYPE,     

              OT_ID           WEB_HR.HR_SHIFT.OT_ID%TYPE ,    

              YEAR_ID           WEB_HR.HR_SHIFT.YEAR_ID%TYPE   

              );

               

              TYPE shifttab_type IS TABLE OF shift_rec INDEX BY BINARY_INTEGER;

               

              PROCEDURE shift_query(sft_tab IN OUT shifttab_type,p_empid   IN NUMBER);

               

              PROCEDURE shift_query(sft_tab IN OUT shifttab_type,p_empid   IN NUMBER)

              is

              CURSOR emp_cur (vempid  web_hr.hr_shift.emp_id%type) is

              select SHIFT_ID, EMP_ID,SHIFT_DATE,DELFLAG, COMPANYCODE,

              ENTRYDATE, SHIFT,OT_ID,year_id

              From web_hr.hr_shift

              where trunc(shift_date)>trunc(sysdate)and emp_id=vempid;

              idx number :=1;

              BEGIN

              sft_tab.delete;

               

              for rec in emp_cur(p_empid) loop

              sft_tab(idx):=rec;

              idx := idx + 1;

              end loop;

              end;

               

              updating shift only.......A to B OR A to C OR B TO G etc..

               

              but my shift are confined only A ,B, C,G ,O AND L only how can validate on oracle form level ?

              during updation it does taking any character...X ,Y ,Z H etc which i don't want.

               

              note that ONE emp_id has multiple records.

              in forms property i can put lowest value  as A  and Highest Value is G

              • 4. Re: Form10g  field validation
                Gurujothi

                Hi Zeeshan,

                 

                You can follow Paul's idea,

                 

                 

                or else create When-Validate-Item trigger on your field,

                 

                if length(:Block_name.Field_name) <>1 and :Block_name.Field_name not in ('A','B','C') then

                --Show message here

                :Block_name.Field_name := null;

                End if;

                 

                or else to be simple

                 

                Create 1 LOV with the following sql,

                 

                select 'A' from dual  

                union

                select 'B' from dual

                union

                select 'C' from dual

                 

                Select validate from List to Yes and assign the LOV to field, It is simple.

                 

                Regards,

                Guru.

                • 5. Re: Form10g  field validation
                  CraigB
                  me_zeeshan wrote:

                  updating shift only.......A to B OR A to C OR B TO G etc..

                   

                  but my shift are confined only A ,B, C,G ,O AND L only how can validate on oracle form level ?

                  during updation it does taking any character...X ,Y ,Z H etc which i don't want.

                  For the type of logic where only certain values are allowed to follow an existing value (eg: Current Val = A, then new value can only be B or C) you can either code this dependency directly into your form in a Item Level When-Validate-Item (WVI) trigger - which will make changes to the dependencies maintenance intensive (eg: you have to modify code to add/remove dependencies) or you can put these dependencies in a table and then use an LOV to limit the next acceptable SHIFT values based on the current SHIFT value.  To force the user to only select from the LOV, you can set the Item level Validate from list property to yes.  Here is an example of how you can setup the tables and record group query to accomplish this.

                   

                  Table:  SHIFT_VALIDATION

                  CURR_VALNEXT_VAL
                  AB
                  AC
                  BG
                  etc...etc...

                   

                  LOV/Record Group query:

                   

                  SELECT next_val
                    FROM shift_validation
                  WHERE curr_val = :YOUR_BLOCK.SHIFT
                  

                   

                  Given your scenario, when the user navigates to the SHIFT field and enters a value or opens the LOV, if the current value of SHIFT is "A" then the LOV will display B and C as acceptable values.

                   

                  Hope this helps.

                  Craig...