Regarding data entry form...

Say we have a data entry form consisting of 100 possible fields

Customer A uses all 100 fields. Customer B uses only a subset of those fields. Customer C uses a diferent subset of those fields.

Does this mean we need three individual screens or is there a way to programmatically suppress unwanted fields from a single screen?

Thx,

Monty

asked 20 Mar '13, 15:37

montylatiolais's gravatar image

montylatiolais
132
accept rate: 0%


Hi Monty,

You don't need three individual screens for that case, you can suppress unwanted fields by hiding them through the api_component.setVisible API.

Consider the following form:

<panel>
  <tableLayout>
    <row heightPolicy="Dynamic">
      <cell>
        <textLabel label="Field 1" name="tl1"/>
      </cell>
      <cell>
        <textField visible="Y" name="tf1"/>
      </cell>
    </row>
    <row heightPolicy="Dynamic">
      <cell>
        <textLabel label="Field 2" name="tl2"/>
      </cell>
      <cell>
        <textField visible="Y" name="tf2"/>
      </cell>
    </row>
    <row heightPolicy="Dynamic">
      <cell>
        <textLabel label="Field 3" name="tl3"/>
      </cell>
      <cell>
        <textField visible="Y" name="tf3"/>
      </cell>
    </row>
    <row heightPolicy="Dynamic">
      <cell>
        <textLabel label="Field 4" name="tl4"/>
      </cell>
      <cell>
        <textField visible="Y" name="tf4"/>
      </cell>
    </row>
  </tableLayout>
</panel>

Assume that Customer B uses Field 1 and Field 2 while Customer C uses Field 3 and Field 4. In this case, you can use a procedure as follows:

procedure adjustForm is
  v_customerType_cd varchar2..;
begin
  ...
  v_customerType_cd := getCustomerType;
  if v_customerType_cd = 'Customer B' then
    -- hide Field 3 and 4 
    api_component.setvisible('panelName.tl3', 'N');
    api_component.setVisible('panelName.tf3', 'N');
    api_component.setvisible('panelName.tl4', 'N');
    api_component.setvisible('panelName.tl4', 'N');
  elsif v_customerType_cd = 'Customer C' then
    -- hide Field 1 and 2 
    api_component.setvisible('panelName.tl1', 'N');
    api_component.setVisible('panelName.tf1', 'N');
    api_component.setvisible('panelName.tl2', 'N');
    api_component.setVisible('panelName.tf2', 'N');
  end if;
end;

If the customer does not change during the application lifecyle, the best time to make these adjustments is the postIntialize event of the form panel. This event is executed once, just after the panel is initialized.

If it's possible to group some fields you may also consider to create a sub-panel for each group and hide these panels instead of the components:

-- panel group1

<panel>
  <tableLayout>
    <row height="20">
      <cell>
        <textLabel label="Field 1"/>
      </cell>
      <cell>
        <textField visible="Y"/>
      </cell>
    </row>
    <row height="20">
      <cell>
        <textLabel label="Field 2"/>
      </cell>
      <cell>
        <textField visible="Y"/>
      </cell>
    </row>
  </tableLayout>
</panel>

-- panel group2

<panel>
  <tableLayout>
    <row height="20">
      <cell>
        <textLabel label="Field 3"/>
      </cell>
      <cell>
        <textField visible="Y"/>
      </cell>
    </row>
    <row height="20">
      <cell>
        <textLabel label="Field 4"/>
      </cell>
      <cell>
        <textField visible="Y"/>
      </cell>
    </row>
  </tableLayout>
</panel>

-- form panel

<panel>
  <tableLayout>
    <row heightPolicy="Dynamic">
      <cell>
        <include panelName="group1"/>
      </cell>
    </row>
    <row heightPolicy="Dynamic">
      <cell>
        <include panelName="group2"/>
      </cell>
    </row>
  </tableLayout>
</panel>

Then you can display the appropriate group by hiding necessary panels:

procedure adjustForm is
  v_customerType_cd varchar2..;
begin
  ...
  v_customerType_cd := getCustomerType;
  if v_customerType_cd = 'Customer B' then
    -- hide group2 
    api_panel.setvisible('group2', 'N');
  elsif v_customerType_cd = 'Customer C' then
    -- hide group1  
    api_panel.setvisible('group1', 'N');
  end if;
end;

Hope this helps,
Ibrahim

link

answered 21 Mar '13, 09:04

Ibrahim%20Sandalli's gravatar image

Ibrahim Sand... ♦♦
1.5k5
accept rate: 25%

edited 21 Mar '13, 09:05

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×1

Asked: 20 Mar '13, 15:37

Seen: 635 times

Last updated: 21 Mar '13, 09:05

Related questions


© Copyright Gerger 2017