Default value gets stored in another column based on value selected from LOV












0















Table-Items



Columns-Order_Type



               (Sales,
Return,
Defective)


Order_Type_Id(1,2,3)
i.e 1-Sales,
2-Return,
3-Defective



VO has Transient attribute-OrderType which has an LOV showing Order_Type.
Based on selected Order_Type, Order_Type_Id should get stored in Order_Type_Id column



public Number getOrder_Type_Id() {
String orderType = null;
Number orderNumber = null;
if (getOrderType() != null) {
orderType = getOrderType();
if (orderType.equals("Sales")) {
orderNumber = new oracle.jbo.domain.Number(2);
} else if (orderType.equals("Return")) {
orderNumber = new oracle.jbo.domain.Number(3);
} else if (orderType.equals("Defective")) {
orderNumber = new oracle.jbo.domain.Number(4);
}
this.setOrder_Type_Id(orderNumber);
}









share|improve this question

























  • can you update your question with viewobject xml source

    – Belal Awwad
    Nov 19 '18 at 8:51











  • So what's happening? Hows your LOV is populated? All the values are static list or coming from any column? Does order_type_id has any default value?

    – Shaili
    Nov 19 '18 at 11:52











  • OrderType has LOV whose values comes from Order_Type in Items table column . It displays Order_Type.Order_Type_Id does not have default value.I used the above code but it displays value 2 every time even if it's not Sales order

    – rahul
    Nov 19 '18 at 12:35













  • Have you tried to print getOrderType() as SOP?

    – Shaili
    Nov 19 '18 at 12:44
















0















Table-Items



Columns-Order_Type



               (Sales,
Return,
Defective)


Order_Type_Id(1,2,3)
i.e 1-Sales,
2-Return,
3-Defective



VO has Transient attribute-OrderType which has an LOV showing Order_Type.
Based on selected Order_Type, Order_Type_Id should get stored in Order_Type_Id column



public Number getOrder_Type_Id() {
String orderType = null;
Number orderNumber = null;
if (getOrderType() != null) {
orderType = getOrderType();
if (orderType.equals("Sales")) {
orderNumber = new oracle.jbo.domain.Number(2);
} else if (orderType.equals("Return")) {
orderNumber = new oracle.jbo.domain.Number(3);
} else if (orderType.equals("Defective")) {
orderNumber = new oracle.jbo.domain.Number(4);
}
this.setOrder_Type_Id(orderNumber);
}









share|improve this question

























  • can you update your question with viewobject xml source

    – Belal Awwad
    Nov 19 '18 at 8:51











  • So what's happening? Hows your LOV is populated? All the values are static list or coming from any column? Does order_type_id has any default value?

    – Shaili
    Nov 19 '18 at 11:52











  • OrderType has LOV whose values comes from Order_Type in Items table column . It displays Order_Type.Order_Type_Id does not have default value.I used the above code but it displays value 2 every time even if it's not Sales order

    – rahul
    Nov 19 '18 at 12:35













  • Have you tried to print getOrderType() as SOP?

    – Shaili
    Nov 19 '18 at 12:44














0












0








0








Table-Items



Columns-Order_Type



               (Sales,
Return,
Defective)


Order_Type_Id(1,2,3)
i.e 1-Sales,
2-Return,
3-Defective



VO has Transient attribute-OrderType which has an LOV showing Order_Type.
Based on selected Order_Type, Order_Type_Id should get stored in Order_Type_Id column



public Number getOrder_Type_Id() {
String orderType = null;
Number orderNumber = null;
if (getOrderType() != null) {
orderType = getOrderType();
if (orderType.equals("Sales")) {
orderNumber = new oracle.jbo.domain.Number(2);
} else if (orderType.equals("Return")) {
orderNumber = new oracle.jbo.domain.Number(3);
} else if (orderType.equals("Defective")) {
orderNumber = new oracle.jbo.domain.Number(4);
}
this.setOrder_Type_Id(orderNumber);
}









share|improve this question
















Table-Items



Columns-Order_Type



               (Sales,
Return,
Defective)


Order_Type_Id(1,2,3)
i.e 1-Sales,
2-Return,
3-Defective



VO has Transient attribute-OrderType which has an LOV showing Order_Type.
Based on selected Order_Type, Order_Type_Id should get stored in Order_Type_Id column



public Number getOrder_Type_Id() {
String orderType = null;
Number orderNumber = null;
if (getOrderType() != null) {
orderType = getOrderType();
if (orderType.equals("Sales")) {
orderNumber = new oracle.jbo.domain.Number(2);
} else if (orderType.equals("Return")) {
orderNumber = new oracle.jbo.domain.Number(3);
} else if (orderType.equals("Defective")) {
orderNumber = new oracle.jbo.domain.Number(4);
}
this.setOrder_Type_Id(orderNumber);
}






oracle-adf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 11:34









Shaili

618826




618826










asked Nov 19 '18 at 6:19









rahulrahul

457




457













  • can you update your question with viewobject xml source

    – Belal Awwad
    Nov 19 '18 at 8:51











  • So what's happening? Hows your LOV is populated? All the values are static list or coming from any column? Does order_type_id has any default value?

    – Shaili
    Nov 19 '18 at 11:52











  • OrderType has LOV whose values comes from Order_Type in Items table column . It displays Order_Type.Order_Type_Id does not have default value.I used the above code but it displays value 2 every time even if it's not Sales order

    – rahul
    Nov 19 '18 at 12:35













  • Have you tried to print getOrderType() as SOP?

    – Shaili
    Nov 19 '18 at 12:44



















  • can you update your question with viewobject xml source

    – Belal Awwad
    Nov 19 '18 at 8:51











  • So what's happening? Hows your LOV is populated? All the values are static list or coming from any column? Does order_type_id has any default value?

    – Shaili
    Nov 19 '18 at 11:52











  • OrderType has LOV whose values comes from Order_Type in Items table column . It displays Order_Type.Order_Type_Id does not have default value.I used the above code but it displays value 2 every time even if it's not Sales order

    – rahul
    Nov 19 '18 at 12:35













  • Have you tried to print getOrderType() as SOP?

    – Shaili
    Nov 19 '18 at 12:44

















can you update your question with viewobject xml source

– Belal Awwad
Nov 19 '18 at 8:51





can you update your question with viewobject xml source

– Belal Awwad
Nov 19 '18 at 8:51













So what's happening? Hows your LOV is populated? All the values are static list or coming from any column? Does order_type_id has any default value?

– Shaili
Nov 19 '18 at 11:52





So what's happening? Hows your LOV is populated? All the values are static list or coming from any column? Does order_type_id has any default value?

– Shaili
Nov 19 '18 at 11:52













OrderType has LOV whose values comes from Order_Type in Items table column . It displays Order_Type.Order_Type_Id does not have default value.I used the above code but it displays value 2 every time even if it's not Sales order

– rahul
Nov 19 '18 at 12:35







OrderType has LOV whose values comes from Order_Type in Items table column . It displays Order_Type.Order_Type_Id does not have default value.I used the above code but it displays value 2 every time even if it's not Sales order

– rahul
Nov 19 '18 at 12:35















Have you tried to print getOrderType() as SOP?

– Shaili
Nov 19 '18 at 12:44





Have you tried to print getOrderType() as SOP?

– Shaili
Nov 19 '18 at 12:44












2 Answers
2






active

oldest

votes


















1














Following code worked.
Writing following code in Order_Type_Id:



public Number Order_Type_Id()
{
String orderType=null;
Number orderNumber=null;
if(getOrder_Type()!=null){
orderType=getOrder_Type();
if(orderType.equals("Sales")){
orderNumber=new oracle.jbo.domain.Number(2);
}
else if(orderType.equals("Defective")){
orderNumber=new oracle.jbo.domain.Number(3);
return orderNumber;
}
else
{
return (Number)getAttributeInternal(Order_Type_Id);}
}
}


In Order_Type_Id attribute add dependency or Order_Type






share|improve this answer


























  • Is it working now?

    – Shaili
    Nov 20 '18 at 7:26











  • If the solution is working please edit the answer properly. So person should understand that it's an answer.

    – Shaili
    Nov 20 '18 at 8:49











  • Yes it's working now..Thanks @Shaili

    – rahul
    Nov 20 '18 at 17:37





















0














Assuming LOV VO is also from Query not from static list :



It is developed in ADF 11g



OrderTypeLOVVO :



  order_type_id  - back-end stored column
order_type_desc - display column


BaseOrderVO



OrderTypeId - transient attribute - LOV - OrderTypeLOVVO 
OrderTypeDesc - transient attribute - OutputText column with default value - 1


orderTypeId



  - Make autoSubmit property true in both places in VO and in jsff page ( drop it as select one choice) .
- OrderTypeId value will be bindings.orderTypeId.inputValue

- Shuffle the dependent attribute Order_type_desc from left to right in dependecies component of VO.


OrderTypeDesc



  Make default value as 1 and in jsff page set partial trigger dependent of orderTypeId after dropping it as output label.
Make OrderTypeDesc value attribute as bindings.orderTypeId.attributeValue


We need to make OrderTypeDesc value as orderTypeId.attributeValue because when you select OrderTypeId as sales (this is inputValue), so backend value (id) is 1. so attributeValue will get the id of the selected value in LOV.



Same works with static list VO too.



As per your requirement, In programatically,



I have created a method on value change listener of LOV,



changeValue() is the method in bean class.



public void changeValue(ValueChangeEvent valueChangeEvent) {
AppModuleImpl module = getApp(); // creating appModuleImpl class object
//definition for getApp() is given below.

item_desc = module.assignValue(valueChangeEvent.getNewValue().toString());
// This item_desc value is declared globally.

//assignValue method of AppModuleClass is given below
bind_item_desc.setValue(item_desc);
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
adfFacesContext.addPartialTarget(bind_item_desc);
// bind_item_desc is the binding attribute of output label which needs to be refreshed.
// Add event code here...
}
public static AppModuleImpl getApp() {
return (AppModuleImpl)Configuration.
createRootApplicationModule(
"Model.AppModule", // where your module is stored
"AppModuleShared"); // chosen configuration
}


Here Model.AppModule is the location of AppModule.



assingValue() of AppModuleClass where it will assign the value according to the selected value in LOV.



public String assignValue(String value)
{
String item_desc=null;
System.out.println("Changed value " + value);
if(value.equals("Sales"))
{
item_desc="14";
}
return item_desc;
}


In assignValue, Parameter is value which will be input from bean class (a selected value from LOV) and returning the String parameter which you will be needed back again in bean class.



So when you select a value in LOV, it will trigger the value change listener method (changeValue()) and will navigate to AppModule . In AppModule , value will be assigned and come back to Bean class.



But it will not reflect untill, you will not refresh the page component.



<af:selectOneChoice value="#{bindings.item_id_lov.inputValue}"
label="item for lov"
required="#{bindings.item_id_lov.hints.mandatory}"
shortDesc="#{bindings.item_id_lov.hints.tooltip}"
id="soc4" autoSubmit="true"
valueChangeListener="#{bean1.changeValue}">
<f:selectItems value="#{bindings.item_id_lov.items}" id="si4"/>
</af:selectOneChoice>


Here value change listener is called in SelectOneChoice and autoSubmit is true.



<af:panelLabelAndMessage label="item description"
id="plam1" partialTriggers="soc4">
<af:outputFormatted value="#{bean1.item_desc}" binding="#{bean1.bind_item_desc}"
id="of1"/>
</af:panelLabelAndMessage>


Here , in value attribute item_desc is assigned (which is declared in bean). Also binding got created for the output label. PartialTrigger is assigned of LOV as outputLabel is dependent on LOV.






share|improve this answer


























  • You want it programatically?

    – Shaili
    Nov 19 '18 at 12:42











  • I wanted to check on AM first.I added above code in RowImpl class..Yes wanted it programatically..

    – rahul
    Nov 19 '18 at 12:45











  • I have updated the answer with programmatic way too.

    – Shaili
    Nov 20 '18 at 8:48











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53369269%2fdefault-value-gets-stored-in-another-column-based-on-value-selected-from-lov%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Following code worked.
Writing following code in Order_Type_Id:



public Number Order_Type_Id()
{
String orderType=null;
Number orderNumber=null;
if(getOrder_Type()!=null){
orderType=getOrder_Type();
if(orderType.equals("Sales")){
orderNumber=new oracle.jbo.domain.Number(2);
}
else if(orderType.equals("Defective")){
orderNumber=new oracle.jbo.domain.Number(3);
return orderNumber;
}
else
{
return (Number)getAttributeInternal(Order_Type_Id);}
}
}


In Order_Type_Id attribute add dependency or Order_Type






share|improve this answer


























  • Is it working now?

    – Shaili
    Nov 20 '18 at 7:26











  • If the solution is working please edit the answer properly. So person should understand that it's an answer.

    – Shaili
    Nov 20 '18 at 8:49











  • Yes it's working now..Thanks @Shaili

    – rahul
    Nov 20 '18 at 17:37


















1














Following code worked.
Writing following code in Order_Type_Id:



public Number Order_Type_Id()
{
String orderType=null;
Number orderNumber=null;
if(getOrder_Type()!=null){
orderType=getOrder_Type();
if(orderType.equals("Sales")){
orderNumber=new oracle.jbo.domain.Number(2);
}
else if(orderType.equals("Defective")){
orderNumber=new oracle.jbo.domain.Number(3);
return orderNumber;
}
else
{
return (Number)getAttributeInternal(Order_Type_Id);}
}
}


In Order_Type_Id attribute add dependency or Order_Type






share|improve this answer


























  • Is it working now?

    – Shaili
    Nov 20 '18 at 7:26











  • If the solution is working please edit the answer properly. So person should understand that it's an answer.

    – Shaili
    Nov 20 '18 at 8:49











  • Yes it's working now..Thanks @Shaili

    – rahul
    Nov 20 '18 at 17:37
















1












1








1







Following code worked.
Writing following code in Order_Type_Id:



public Number Order_Type_Id()
{
String orderType=null;
Number orderNumber=null;
if(getOrder_Type()!=null){
orderType=getOrder_Type();
if(orderType.equals("Sales")){
orderNumber=new oracle.jbo.domain.Number(2);
}
else if(orderType.equals("Defective")){
orderNumber=new oracle.jbo.domain.Number(3);
return orderNumber;
}
else
{
return (Number)getAttributeInternal(Order_Type_Id);}
}
}


In Order_Type_Id attribute add dependency or Order_Type






share|improve this answer















Following code worked.
Writing following code in Order_Type_Id:



public Number Order_Type_Id()
{
String orderType=null;
Number orderNumber=null;
if(getOrder_Type()!=null){
orderType=getOrder_Type();
if(orderType.equals("Sales")){
orderNumber=new oracle.jbo.domain.Number(2);
}
else if(orderType.equals("Defective")){
orderNumber=new oracle.jbo.domain.Number(3);
return orderNumber;
}
else
{
return (Number)getAttributeInternal(Order_Type_Id);}
}
}


In Order_Type_Id attribute add dependency or Order_Type







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 20 '18 at 17:36

























answered Nov 20 '18 at 5:12









rahulrahul

457




457













  • Is it working now?

    – Shaili
    Nov 20 '18 at 7:26











  • If the solution is working please edit the answer properly. So person should understand that it's an answer.

    – Shaili
    Nov 20 '18 at 8:49











  • Yes it's working now..Thanks @Shaili

    – rahul
    Nov 20 '18 at 17:37





















  • Is it working now?

    – Shaili
    Nov 20 '18 at 7:26











  • If the solution is working please edit the answer properly. So person should understand that it's an answer.

    – Shaili
    Nov 20 '18 at 8:49











  • Yes it's working now..Thanks @Shaili

    – rahul
    Nov 20 '18 at 17:37



















Is it working now?

– Shaili
Nov 20 '18 at 7:26





Is it working now?

– Shaili
Nov 20 '18 at 7:26













If the solution is working please edit the answer properly. So person should understand that it's an answer.

– Shaili
Nov 20 '18 at 8:49





If the solution is working please edit the answer properly. So person should understand that it's an answer.

– Shaili
Nov 20 '18 at 8:49













Yes it's working now..Thanks @Shaili

– rahul
Nov 20 '18 at 17:37







Yes it's working now..Thanks @Shaili

– rahul
Nov 20 '18 at 17:37















0














Assuming LOV VO is also from Query not from static list :



It is developed in ADF 11g



OrderTypeLOVVO :



  order_type_id  - back-end stored column
order_type_desc - display column


BaseOrderVO



OrderTypeId - transient attribute - LOV - OrderTypeLOVVO 
OrderTypeDesc - transient attribute - OutputText column with default value - 1


orderTypeId



  - Make autoSubmit property true in both places in VO and in jsff page ( drop it as select one choice) .
- OrderTypeId value will be bindings.orderTypeId.inputValue

- Shuffle the dependent attribute Order_type_desc from left to right in dependecies component of VO.


OrderTypeDesc



  Make default value as 1 and in jsff page set partial trigger dependent of orderTypeId after dropping it as output label.
Make OrderTypeDesc value attribute as bindings.orderTypeId.attributeValue


We need to make OrderTypeDesc value as orderTypeId.attributeValue because when you select OrderTypeId as sales (this is inputValue), so backend value (id) is 1. so attributeValue will get the id of the selected value in LOV.



Same works with static list VO too.



As per your requirement, In programatically,



I have created a method on value change listener of LOV,



changeValue() is the method in bean class.



public void changeValue(ValueChangeEvent valueChangeEvent) {
AppModuleImpl module = getApp(); // creating appModuleImpl class object
//definition for getApp() is given below.

item_desc = module.assignValue(valueChangeEvent.getNewValue().toString());
// This item_desc value is declared globally.

//assignValue method of AppModuleClass is given below
bind_item_desc.setValue(item_desc);
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
adfFacesContext.addPartialTarget(bind_item_desc);
// bind_item_desc is the binding attribute of output label which needs to be refreshed.
// Add event code here...
}
public static AppModuleImpl getApp() {
return (AppModuleImpl)Configuration.
createRootApplicationModule(
"Model.AppModule", // where your module is stored
"AppModuleShared"); // chosen configuration
}


Here Model.AppModule is the location of AppModule.



assingValue() of AppModuleClass where it will assign the value according to the selected value in LOV.



public String assignValue(String value)
{
String item_desc=null;
System.out.println("Changed value " + value);
if(value.equals("Sales"))
{
item_desc="14";
}
return item_desc;
}


In assignValue, Parameter is value which will be input from bean class (a selected value from LOV) and returning the String parameter which you will be needed back again in bean class.



So when you select a value in LOV, it will trigger the value change listener method (changeValue()) and will navigate to AppModule . In AppModule , value will be assigned and come back to Bean class.



But it will not reflect untill, you will not refresh the page component.



<af:selectOneChoice value="#{bindings.item_id_lov.inputValue}"
label="item for lov"
required="#{bindings.item_id_lov.hints.mandatory}"
shortDesc="#{bindings.item_id_lov.hints.tooltip}"
id="soc4" autoSubmit="true"
valueChangeListener="#{bean1.changeValue}">
<f:selectItems value="#{bindings.item_id_lov.items}" id="si4"/>
</af:selectOneChoice>


Here value change listener is called in SelectOneChoice and autoSubmit is true.



<af:panelLabelAndMessage label="item description"
id="plam1" partialTriggers="soc4">
<af:outputFormatted value="#{bean1.item_desc}" binding="#{bean1.bind_item_desc}"
id="of1"/>
</af:panelLabelAndMessage>


Here , in value attribute item_desc is assigned (which is declared in bean). Also binding got created for the output label. PartialTrigger is assigned of LOV as outputLabel is dependent on LOV.






share|improve this answer


























  • You want it programatically?

    – Shaili
    Nov 19 '18 at 12:42











  • I wanted to check on AM first.I added above code in RowImpl class..Yes wanted it programatically..

    – rahul
    Nov 19 '18 at 12:45











  • I have updated the answer with programmatic way too.

    – Shaili
    Nov 20 '18 at 8:48
















0














Assuming LOV VO is also from Query not from static list :



It is developed in ADF 11g



OrderTypeLOVVO :



  order_type_id  - back-end stored column
order_type_desc - display column


BaseOrderVO



OrderTypeId - transient attribute - LOV - OrderTypeLOVVO 
OrderTypeDesc - transient attribute - OutputText column with default value - 1


orderTypeId



  - Make autoSubmit property true in both places in VO and in jsff page ( drop it as select one choice) .
- OrderTypeId value will be bindings.orderTypeId.inputValue

- Shuffle the dependent attribute Order_type_desc from left to right in dependecies component of VO.


OrderTypeDesc



  Make default value as 1 and in jsff page set partial trigger dependent of orderTypeId after dropping it as output label.
Make OrderTypeDesc value attribute as bindings.orderTypeId.attributeValue


We need to make OrderTypeDesc value as orderTypeId.attributeValue because when you select OrderTypeId as sales (this is inputValue), so backend value (id) is 1. so attributeValue will get the id of the selected value in LOV.



Same works with static list VO too.



As per your requirement, In programatically,



I have created a method on value change listener of LOV,



changeValue() is the method in bean class.



public void changeValue(ValueChangeEvent valueChangeEvent) {
AppModuleImpl module = getApp(); // creating appModuleImpl class object
//definition for getApp() is given below.

item_desc = module.assignValue(valueChangeEvent.getNewValue().toString());
// This item_desc value is declared globally.

//assignValue method of AppModuleClass is given below
bind_item_desc.setValue(item_desc);
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
adfFacesContext.addPartialTarget(bind_item_desc);
// bind_item_desc is the binding attribute of output label which needs to be refreshed.
// Add event code here...
}
public static AppModuleImpl getApp() {
return (AppModuleImpl)Configuration.
createRootApplicationModule(
"Model.AppModule", // where your module is stored
"AppModuleShared"); // chosen configuration
}


Here Model.AppModule is the location of AppModule.



assingValue() of AppModuleClass where it will assign the value according to the selected value in LOV.



public String assignValue(String value)
{
String item_desc=null;
System.out.println("Changed value " + value);
if(value.equals("Sales"))
{
item_desc="14";
}
return item_desc;
}


In assignValue, Parameter is value which will be input from bean class (a selected value from LOV) and returning the String parameter which you will be needed back again in bean class.



So when you select a value in LOV, it will trigger the value change listener method (changeValue()) and will navigate to AppModule . In AppModule , value will be assigned and come back to Bean class.



But it will not reflect untill, you will not refresh the page component.



<af:selectOneChoice value="#{bindings.item_id_lov.inputValue}"
label="item for lov"
required="#{bindings.item_id_lov.hints.mandatory}"
shortDesc="#{bindings.item_id_lov.hints.tooltip}"
id="soc4" autoSubmit="true"
valueChangeListener="#{bean1.changeValue}">
<f:selectItems value="#{bindings.item_id_lov.items}" id="si4"/>
</af:selectOneChoice>


Here value change listener is called in SelectOneChoice and autoSubmit is true.



<af:panelLabelAndMessage label="item description"
id="plam1" partialTriggers="soc4">
<af:outputFormatted value="#{bean1.item_desc}" binding="#{bean1.bind_item_desc}"
id="of1"/>
</af:panelLabelAndMessage>


Here , in value attribute item_desc is assigned (which is declared in bean). Also binding got created for the output label. PartialTrigger is assigned of LOV as outputLabel is dependent on LOV.






share|improve this answer


























  • You want it programatically?

    – Shaili
    Nov 19 '18 at 12:42











  • I wanted to check on AM first.I added above code in RowImpl class..Yes wanted it programatically..

    – rahul
    Nov 19 '18 at 12:45











  • I have updated the answer with programmatic way too.

    – Shaili
    Nov 20 '18 at 8:48














0












0








0







Assuming LOV VO is also from Query not from static list :



It is developed in ADF 11g



OrderTypeLOVVO :



  order_type_id  - back-end stored column
order_type_desc - display column


BaseOrderVO



OrderTypeId - transient attribute - LOV - OrderTypeLOVVO 
OrderTypeDesc - transient attribute - OutputText column with default value - 1


orderTypeId



  - Make autoSubmit property true in both places in VO and in jsff page ( drop it as select one choice) .
- OrderTypeId value will be bindings.orderTypeId.inputValue

- Shuffle the dependent attribute Order_type_desc from left to right in dependecies component of VO.


OrderTypeDesc



  Make default value as 1 and in jsff page set partial trigger dependent of orderTypeId after dropping it as output label.
Make OrderTypeDesc value attribute as bindings.orderTypeId.attributeValue


We need to make OrderTypeDesc value as orderTypeId.attributeValue because when you select OrderTypeId as sales (this is inputValue), so backend value (id) is 1. so attributeValue will get the id of the selected value in LOV.



Same works with static list VO too.



As per your requirement, In programatically,



I have created a method on value change listener of LOV,



changeValue() is the method in bean class.



public void changeValue(ValueChangeEvent valueChangeEvent) {
AppModuleImpl module = getApp(); // creating appModuleImpl class object
//definition for getApp() is given below.

item_desc = module.assignValue(valueChangeEvent.getNewValue().toString());
// This item_desc value is declared globally.

//assignValue method of AppModuleClass is given below
bind_item_desc.setValue(item_desc);
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
adfFacesContext.addPartialTarget(bind_item_desc);
// bind_item_desc is the binding attribute of output label which needs to be refreshed.
// Add event code here...
}
public static AppModuleImpl getApp() {
return (AppModuleImpl)Configuration.
createRootApplicationModule(
"Model.AppModule", // where your module is stored
"AppModuleShared"); // chosen configuration
}


Here Model.AppModule is the location of AppModule.



assingValue() of AppModuleClass where it will assign the value according to the selected value in LOV.



public String assignValue(String value)
{
String item_desc=null;
System.out.println("Changed value " + value);
if(value.equals("Sales"))
{
item_desc="14";
}
return item_desc;
}


In assignValue, Parameter is value which will be input from bean class (a selected value from LOV) and returning the String parameter which you will be needed back again in bean class.



So when you select a value in LOV, it will trigger the value change listener method (changeValue()) and will navigate to AppModule . In AppModule , value will be assigned and come back to Bean class.



But it will not reflect untill, you will not refresh the page component.



<af:selectOneChoice value="#{bindings.item_id_lov.inputValue}"
label="item for lov"
required="#{bindings.item_id_lov.hints.mandatory}"
shortDesc="#{bindings.item_id_lov.hints.tooltip}"
id="soc4" autoSubmit="true"
valueChangeListener="#{bean1.changeValue}">
<f:selectItems value="#{bindings.item_id_lov.items}" id="si4"/>
</af:selectOneChoice>


Here value change listener is called in SelectOneChoice and autoSubmit is true.



<af:panelLabelAndMessage label="item description"
id="plam1" partialTriggers="soc4">
<af:outputFormatted value="#{bean1.item_desc}" binding="#{bean1.bind_item_desc}"
id="of1"/>
</af:panelLabelAndMessage>


Here , in value attribute item_desc is assigned (which is declared in bean). Also binding got created for the output label. PartialTrigger is assigned of LOV as outputLabel is dependent on LOV.






share|improve this answer















Assuming LOV VO is also from Query not from static list :



It is developed in ADF 11g



OrderTypeLOVVO :



  order_type_id  - back-end stored column
order_type_desc - display column


BaseOrderVO



OrderTypeId - transient attribute - LOV - OrderTypeLOVVO 
OrderTypeDesc - transient attribute - OutputText column with default value - 1


orderTypeId



  - Make autoSubmit property true in both places in VO and in jsff page ( drop it as select one choice) .
- OrderTypeId value will be bindings.orderTypeId.inputValue

- Shuffle the dependent attribute Order_type_desc from left to right in dependecies component of VO.


OrderTypeDesc



  Make default value as 1 and in jsff page set partial trigger dependent of orderTypeId after dropping it as output label.
Make OrderTypeDesc value attribute as bindings.orderTypeId.attributeValue


We need to make OrderTypeDesc value as orderTypeId.attributeValue because when you select OrderTypeId as sales (this is inputValue), so backend value (id) is 1. so attributeValue will get the id of the selected value in LOV.



Same works with static list VO too.



As per your requirement, In programatically,



I have created a method on value change listener of LOV,



changeValue() is the method in bean class.



public void changeValue(ValueChangeEvent valueChangeEvent) {
AppModuleImpl module = getApp(); // creating appModuleImpl class object
//definition for getApp() is given below.

item_desc = module.assignValue(valueChangeEvent.getNewValue().toString());
// This item_desc value is declared globally.

//assignValue method of AppModuleClass is given below
bind_item_desc.setValue(item_desc);
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
adfFacesContext.addPartialTarget(bind_item_desc);
// bind_item_desc is the binding attribute of output label which needs to be refreshed.
// Add event code here...
}
public static AppModuleImpl getApp() {
return (AppModuleImpl)Configuration.
createRootApplicationModule(
"Model.AppModule", // where your module is stored
"AppModuleShared"); // chosen configuration
}


Here Model.AppModule is the location of AppModule.



assingValue() of AppModuleClass where it will assign the value according to the selected value in LOV.



public String assignValue(String value)
{
String item_desc=null;
System.out.println("Changed value " + value);
if(value.equals("Sales"))
{
item_desc="14";
}
return item_desc;
}


In assignValue, Parameter is value which will be input from bean class (a selected value from LOV) and returning the String parameter which you will be needed back again in bean class.



So when you select a value in LOV, it will trigger the value change listener method (changeValue()) and will navigate to AppModule . In AppModule , value will be assigned and come back to Bean class.



But it will not reflect untill, you will not refresh the page component.



<af:selectOneChoice value="#{bindings.item_id_lov.inputValue}"
label="item for lov"
required="#{bindings.item_id_lov.hints.mandatory}"
shortDesc="#{bindings.item_id_lov.hints.tooltip}"
id="soc4" autoSubmit="true"
valueChangeListener="#{bean1.changeValue}">
<f:selectItems value="#{bindings.item_id_lov.items}" id="si4"/>
</af:selectOneChoice>


Here value change listener is called in SelectOneChoice and autoSubmit is true.



<af:panelLabelAndMessage label="item description"
id="plam1" partialTriggers="soc4">
<af:outputFormatted value="#{bean1.item_desc}" binding="#{bean1.bind_item_desc}"
id="of1"/>
</af:panelLabelAndMessage>


Here , in value attribute item_desc is assigned (which is declared in bean). Also binding got created for the output label. PartialTrigger is assigned of LOV as outputLabel is dependent on LOV.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 20 '18 at 12:23

























answered Nov 19 '18 at 12:41









ShailiShaili

618826




618826













  • You want it programatically?

    – Shaili
    Nov 19 '18 at 12:42











  • I wanted to check on AM first.I added above code in RowImpl class..Yes wanted it programatically..

    – rahul
    Nov 19 '18 at 12:45











  • I have updated the answer with programmatic way too.

    – Shaili
    Nov 20 '18 at 8:48



















  • You want it programatically?

    – Shaili
    Nov 19 '18 at 12:42











  • I wanted to check on AM first.I added above code in RowImpl class..Yes wanted it programatically..

    – rahul
    Nov 19 '18 at 12:45











  • I have updated the answer with programmatic way too.

    – Shaili
    Nov 20 '18 at 8:48

















You want it programatically?

– Shaili
Nov 19 '18 at 12:42





You want it programatically?

– Shaili
Nov 19 '18 at 12:42













I wanted to check on AM first.I added above code in RowImpl class..Yes wanted it programatically..

– rahul
Nov 19 '18 at 12:45





I wanted to check on AM first.I added above code in RowImpl class..Yes wanted it programatically..

– rahul
Nov 19 '18 at 12:45













I have updated the answer with programmatic way too.

– Shaili
Nov 20 '18 at 8:48





I have updated the answer with programmatic way too.

– Shaili
Nov 20 '18 at 8:48


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53369269%2fdefault-value-gets-stored-in-another-column-based-on-value-selected-from-lov%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith