Code problem - field value derived from drop down values

I have a drop down with about 6 choices. The user can enter their own amount for "quantity" in the drop down if they don't want to use one of the 6 choices. The code below I've attached to another field on another page of the form. (1) I can enter my own value it displays fine. (2) If I pick the #6 option on the drop down, it displays "3000" as required. The other 5 choices however, display 1, 2, 3, 4, or 5 instead of the actual value - "100", "500" etc....
Seems to work for one of the 6 choices, but none of the rest.....
if (form1.orderPage1.stdLayout.quantity.rawValue == "1") {
this.rawValue = "1000";
if (form1.orderPage1.stdLayout.quantity.rawValue == "2") {
this.rawValue = "500";
if (form1.orderPage1.stdLayout.quantity.rawValue == "3") {
this.rawValue = "250";
if (form1.orderPage1.stdLayout.quantity.rawValue == "4") {
this.rawValue = "2000";
if (form1.orderPage1.stdLayout.quantity.rawValue == "5") {
this.rawValue = "2500";
if (form1.orderPage1.stdLayout.quantity.rawValue == "6") {
this.rawValue = "3000";
}else{
this.rawValue = form1.orderPage1.stdLayout.quantity.rawValue;
Need to learn more about "else" in Adobe JS....
As always, any help is greatly appreciated!
Mike Foster

Have you read your code? If your quantity value is between "1" and "5" the result value is being set correctly; then for the test for a value of "6", since your quantity value is not "6" you setting the value to the quantity value. Modify your original code to print some flow information to the JavaScirpt console and you see what is happening, be sure to open Acrobat to see the results in the JavaScript console:
/* original code */
console.show();
console.clear();
console.println("Original");
if (quantity.rawValue == "1") {
console.println(1);
this.rawValue = 1000;
if (quantity.rawValue == "2") {
console.println(2);
this.rawValue = 500;
if (quantity.rawValue == "3") {
console.println(3);
this.rawValue = 250;
if (quantity.rawValue == "4") {
console.println(4);
this.rawValue = 2000;
if (quantity.rawValue == "5") {
console.println(5);
this.rawValue = 2500;
if (quantity.rawValue == "6") {
console.println(6);
this.rawValue = 3000;
} else { // since quantity != "6" do this
console.println("Other");
this.rawValue = quantity.rawValue;
There are many ways to solve your problem. First you can nest the "if" statements, so the "else" clause is applies to all the previous "if" statements:
/* using nested if statements */
console.show();
console.clear();
console.println("Nested if then else");
if (quantity.rawValue == "1") {
console.println("1");
this.rawValue = 1000;
} else {
if (quantity.rawValue == "2") {
console.println("2");
this.rawValue = 500;
} else {
if (quantity.rawValue == "3") {
console.println("3");
this.rawValue = 250;
else {
if (quantity.rawValue == "4") {
console.println("4");
this.rawValue = 2000;
} else {
if (quantity.rawValue == "5") {
console.println("5");
this.rawValue = 2500;
} else {
if (quantity.rawValue == "6") {
console.println("6");
this.rawValue = 3000;
} else { // if none of the above
console.println("Other");
this.rawValue = quantity.rawValue;
Next you could not use an else statement at all, just do a final test for any values outside the range of "1" - "6".
/* quantity not in range */
console.show();
console.clear();
console.println("if quantity < 1 or > 6");
this.rawValue = null; // empty result field
if (quantity.rawValue == "1") {
console.println("1");
this.rawValue = 1000;
if (quantity.rawValue == "2") {
console.println("2");
this.rawValue = 500;
if (quantity.rawValue == "3") {
console.println("3");
this.rawValue = 250;
if (quantity.rawValue == "4") {
console.println("4");
this.rawValue = 2000;
if (quantity.rawValue == "5") {
console.println("5");
this.rawValue = 2500;
if (quantity.rawValue == "6") {
console.println("6");
this.rawValue = 3000;
if (quantity.rawValue < 1| quantity.rawValue > 6) { // if quantity value not between 1 and 6
console.println("Other");
this.rawValue = quantity.rawValue
And finally, you can use the "switch" statement to select an action based on the value of the quantity value and ignore the rest of the test. If no test has been selected, then perform the default action.
/* using switch on quantity value statement */
console.show();
console.clear();
switch (quantity.rawValue) {
case "1":
console.println("1");
this.rawValue = 1000;
break;
case "2":
console.println("2");
this.rawValue = 500;
break;
case "3":
console.println("3");
this.rawValue = 250;
break;
case "4":
console.println("4");
this.rawValue = 2000;
break;
case "5":
console.println("5");
this.rawValue = 2500;
break;
case "6":
console.println("6");
this.rawValue = 3000;
break;
default: // all other values
console.println("Other");
this.rawValue = quantity.rawValue
break;
} // end switch quantity

Similar Messages

  • Inactive field "Project Versions' - from drop down

    Hi Friends
    I have created two versions of project through Tcode CN41. When I am looking for comparision, the field Project Versions from drop down is Inactive ie Edit >Comparisations > Project Versions.  I am sure that I am missing somethig but unable to detect the same to activate Project Versions.
    Would appreciate any one can help me to find out how to get activation of Project Version from drop down.Reward points can be awarded for suitable solution.
    Thanks in advance.
    Regards
    Sudhakar

    Hi Sudhakar,
    I guess you are referring to project versions, not CO versions...
    In this case, please make sure you select at least one version and the current data in the selection screen or more than one versions in the selection screen.
    You need to select the versions in the selection screen in order to compare them.
    If you cannot find the relevant fields to enter the selected version in the selection
    screen, please call the database profile and tick the flag on "version data".
    Hope this helps!!!
    Rgds
    Martina

  • Drop Down values from WDA

    Hi experts,
    I want to create a Drop down in forms with values from Web dynpro Abap Node(0..N) and enable / disable other fields based on selected Drop down value. I binded the data source to DD but values are not populated in it. Please help me to fill values and do validation on selected dd value ....
    -RK

    Hi RK ,
    I made an dropdownlist link with a parameter of the interface without trouble, so i thnik the only way to solve your problem is to populate an internal table which is send to the forms thru the interface.
    Hope this help you
    Regards

  • How to capture selected value from drop down by index

    Dear friends,
    i want to capture the value of select value from drop down by index, for eg if  select air france, how to capture , could any one please let me know
    Thanks
    Vijaya

    Hi Vijaya,
    You can get the value of selected from drop down as below
    Check out the event handler method attached to Onselect event of the ui element drop down by index , if no event is associated, then create an event and attach to the drop down list
    Now you will be having the CONTEXT_ELEMENT in the WDEVENT parameter
                   data lo_element type ref to if_wd_context_element.
                   lo_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT').
    Now, you can get the static attribute value of selected  drop down value & let us say your drop down list values are populated from context node 'ND_DRP_DOWN'
                   data ls_data type wd_this->element_nd_drp_down.
                             lo_element->get_static_attributes(
                                       importing
                                       static_attributes = ls_data ).
    Hope this helps you.
    Regards,
    Rama

  • How to fill drop down value in BDC

    HI  Friends-
    AM using PA30 tcode in my BDC recording , its filling rest value but ,  for drop down values its not showing value .
    how i can pass the drop down values here ?
    Regards
    Meeta

    Hi Meeta,
    You need to use the function module 'VRM_SET_VALUES' to set values for drop down list.
    Refer to the link below for more info...
    Re: Populating values in dropdown based on values selected in second dropdown.
    Thanks
    Alis

  • I have created a PDF form with multiple drop downs, all with the same drop down values. When I select a value from 1 of the drop down fields, it replicates in all of the others - which I do not want. How can I fix this?

    I have created a PDF form with multiple drop downs, all with the same drop down values. When I select a value from 1 of the drop down fields, it replicates in all of the others - which I do not want. Can I fix this?

    I'm fairly new to this, but I think it has to do with the way you have the drop downs named. Did you copy one then keep pasting it in each field? If so, that is the problem. You should rename each one with a different number: Dropdown1, Dropdown2, etc. I think that might solve the issue.

  • Unable to capture data from drop down list in custom added field in migo tcode at item level

    Hi guys,
    need bit help in resolving query related to custom added field in Tcode migo.
    i have added a field in migo at item level ,in this i have used drop down list
    to get data but unable to capture data from drop down list.gown through
    many blogs in scn but unable to resolve.
    Please help me out in this.
    Thanks,
    Umakant.

    Hi,
    U can use following code to fill the list box
    write this code in PBO
    In layout editor please select listbox in dropdown attribute of input field and put some fctcode attribute
    TYPE-POOLS vrm.
      DATA values TYPE vrm_values WITH HEADER LINE.
      TABLES: <ur custom Database table>.
      clear values, values[].
      SELECT * FROM <ur custom Database table>.
        values-text = <TABLE FIELD TO DISPLAY IN DROPDOWN> .
        values-key = <TABLE KEY FIELD TO DISPLAY IN DROPDOWN>.
        APPEND values.
      ENDSELECT.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = '<SCREEN INPUT FIELD NAME>'
          values          = values[]
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
    Also please define the following before accessing the listbox value
    data: <listbox input field name> type <table field name>,
            <inputfield name where text to display> type string  in top include
    In PAI, select the text from the table into <inputfield name where text to display>  depending on value selected which will be called when enter key is pressed or any vale is selected

  • Web UI - Value not getting selected from drop down list  .

    Hi  All ,
        I am facing a problem in one of the fields which is enhanced with a drop down functionality .
      I have created the GET_V_** method and also the GET_P_**  method for the same .And finally I am able to see the values in the drop down list . But the problem is , when I am trying to select a value from the drop down no values are selected .
    Can anyone plese help me in this as What has to be  done .
    I have taken references from few guides but I am not getting any clear idea of what has to be done .
    Regards,
    Ranjita

    Hi Ranjita,
                     To trigger a round trip, you must have given the event name in GET_P method.
    Same event handler would trigger.
      Please put a break point in Event Handler in IMPL class, and in SET_attr method of the attribute in CN class and see if value is getting set properly or not. Final value that would be displayed on UI would be there in GET_attr method of CN class.
      I hope it helps.
    Thanks,
    Rohit

  • Crystal report Chose from List or drop down value in parameter from UDT

    Hi Experts,
    I had face a issue while creating a report for my client in crystal report , I had create a report and in the parameter field I want to select the value from the chose from list or drop down value from the User define table.
    In parameter had written field as : Code@Select * from dbo. [@UDT] ;  but in the report filled I am not able to select the value.
    Please Help me ! Thanks in Advance. :

    HI
    Welcome to the Forum...
    You cannot put all the values in a single parameter field so you need to select each field for each parameter...
    Better you post it in this link for more reponses:
    Reporting and Printing

  • SCAC Field Should have Drop Down Values and ASN should have Storage locatio

    Hi ,
    We have a requirement while creating ASN in which we have to add SCAC ID  in the SCAC field ( Carrier)  this SCAC ID comes in Shipping details  - We want to have drop down values in this field and also if we dont enter value in this field An Error Message should come like " Maintain SCAC code.
    And also the PO's coming from ECC are not carrying Storage location information - Is there a specific config / enhancement to be done.
    And in ASN can we have Storage location ?
    Thanks,
    Mahesh

    Hi Mahesh
    Regarding adding fields to UI
    Refer below links
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e0b0e544-7a06-2d10-539d-f8648358ba67?quicklink=index&overridelayout=true
    http://wiki.sdn.sap.com/wiki/display/SCM/SAPSupplyNetworkCollaboration%28SAP+SNC%29
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/908c1e69-0a01-2d10-e7a6-98ca00f19aa6?quicklink=index&overridelayout=true
    Not sure how to maintain it as a drop down, a developer could help you easily with that.
    Regarding Storage location from PO ECC.
    If you are using idocs, the standard SAP xml conversion will not be able to transfer this(if you download standard content)
    You can find the field in your IDOC ORDERS05, Data records-Segement-E1EDP01FIELDLGORD
    In order to transfer this, you need to rewrite the xml format in integration builder of XI/PI and then add some UI fields in Webui
    to show.
    But xml PurchaseOrderERPReplenishmentOrderCollaborationNotification as of SAP ECC EHP4 can carry this information in its payload document(SXI_MONITOR---INBOUND MESSAGE ---PAYLOADS) Under the node INVENTORY MANAGED LOCATION
    Not sure where this field is mapped to .........
    I will let you know once i find........Mean while you can ask any developer who worked on webdynpro .
    Yes we can have this field once we find where it is mapping, if you are using idocs then even the XML has to be build in PI
    accordingly.
    Best Regards
    Vinod

  • HCM F&P - How to set the field as Required based on drop down values

    Hi Experts,
    I have a requirement to set the Date field as mandatory when a particular value is selected in drop down list. I have already tried with MessageBox though it displays the error message but process moves further i.e. on clicking Check & Send button it throws an error message but still it moves further and i can see only Send button. Ideally it should halt there itself.
    Thanks & Regards,
    Jitesh Talreja

    Thanks for your valuable inputs
    Chintan
    I have already tried this. It only highlight the field with the red border but still allow to move further.
    Mukesh
    Yes, we can definately control this from the backend but that would be the last option i should execute. Ideally, this is something to be controlled in front end itself
    Poornima
    By setting the field attrbiute Required will set the field mandatory as a whole irrespective of drop down values or any other UI element.
    Regards,
    Jitesh Talreja

  • Problem with Enumerated drop-down values in Adobe Forms (WD java)

    Hi All,
    have a scenario where, I have to fill in a dropdown dynamically when I click a button. I get the values from a function module. I have done this using Isimpletypemodifiablestep. It worked.I have the form too. But when I try to re-implement the same its working only if I give the values during initialisation .
    Why is this inconsistent?
    Can we modify Simple types only during initialization? I have tried to add the values to the drop-down in controller and map the attribute to view. Even that didn't work.
    I'm
    Am using Adobe Live cycle designer 7.1 and NWDS 7.1
    SAP 2004s SP15
    Thanks,
    Vasu

    Hi Arafat,
                   I have tried that already. It didn't work. As of now, I've copied the form thats working into the new project.
    But I didn't find a solution for the problem.
    Thank you,
    Vasu

  • Problem in getting the current value of the drop down while calling value change listener

    I have 2 drop down list. I am trying to get the value of first drop down from other drop downs value change listener. Initially one drop down contains a default value. First time I got the value while calling the value change listener. But if I change the default value to other in the first drop down and call the value change listener of the second drop down then I got the old value in the bean. Can anyone suggest a process

    If I use the following code it gives me the current index.
                valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());
                System.out.println(valueChangeEvent.getNewValue());
    This is also giving me current index.
    BindingContainer container = BindingContext.getCurrent().getCurrentBindingsEntry();
    AttributeBinding attrIdBinding = (AttributeBinding)container.getControlBinding("PersonTypeId1");
    if(attrIdBinding.getInputValue()!=null)
                   System.out.println(attrIdBinding.getInputValue().toString());
    But at last I got some help from Shay Shmeltzer's Weblog.
    BindingContainer bindings =
                    BindingContext.getCurrent().getCurrentBindingsEntry();
                    // Get the sepecific list binding
                    JUCtrlListBinding listBinding =
                    (JUCtrlListBinding)bindings.get("PersonTypeId1");
                    // Get the value which is currently selected
                    Object selectedValue = listBinding.getSelectedValue();
                      long value =0L;
                    if(selectedValue!=null){
                        System.out.println("Sudip.. Person Type using bindings"+selectedValue.toString());
    But this returns "ViewRow [oracle.jbo.Key[300000860721156 ]]"
    300000860721156 is the original value.. Would you please help me to figure it.

  • How do i populate one field based upon a drop down select from another field?

    Here is what I am trying to do:
    Field 1 is a drop down selection list that requires a user to make a mandatory selection which in this case is a list of apartment complexes. What I am trying to accomplish is once that user makes a selection from the drop down list (Field1) that it will populate Field 2 (standard txt) with the corresponding apartment complexes address.
    So I pick Talan Apartments from field 1, it would populate field 2 with Talan Apartments address. I tried messing around with calculation scripts but I'm fighting a loosing battle here. Some help would be greatly appreciated!

    Hi,
    Here is a sample: https://acrobat.com/#d=Hi0ZwVgVB1PWbxc6OJ0z4A where the script in the exit event of the dropdown sets the value of the address object.
    Good luck,
    Niall

  • Table TZC37 field STATU search help drop down is not pulling any values?

    Hi,
    In table TZC37 field STATU(Contract status) search help is not pulling any values( drop down list when execute the table values) .. but the table has values for this field.
    And also I checked in the configuration, this field has values in the config also. But still the search drop down is not getting any values.
    Can any one knows what could be the reason and how to solve this issue?
    I am using this field in transaction FNVS when searching loan number based on Status field.
    Thanks for your time.
    Murali.

    Hi Micky,
    I am using this in transaction FNVS (when searching Loan number based on Status field( this is Custom Search help added this field ( VDARL- SSTATI )
    Value table for this data type - STATI is TZC37.
    While getting records from these tables(TZC37 or VDARL )  I am trying to use drop down values for searching data using this field SSTATI. But its not showing any drop down values. It supposed to show what ever values exists for this field  right?
    I checked in the cofig of this table and values exists for this field.
    Any help appreciated.
    Thanks.

Maybe you are looking for

  • Question about configuration (ATI 5770) w/ 3 monitors

    Ok I already know how to get three monitors running on the ATI 5770.  I have one native mini DisplayPort, one mini DisplyPort to VGA and one native  DVI or DVI to HDMI.  What I need to know (before I buy another native mini DisplayPort monitor) is if

  • How do I move music files from G4 to my new macbook?

    I would like to move my music library from my G4 to my new macbook. the macbook doesn't have a firewire port. It has an enternet and usb ports. what is the simplest way to do this.

  • PowerMac G3 B/W will no longer recognize flash drive

    Ive been using a flash drive with my PowerMac to transfer files to my Mac mini. It always worked but now for some reason it won't show up on the desktop or finder. It shows up in disk utility though and I've tried both usb ports and nothIng.  Even tr

  • My iphoto 09 won't open' ?

    ?error message says I made changes using a newer version and must use new version to open. I have deleted and reinstalled iLife09 from disc and downloaded all software updates for iphoto8.

  • Refine Edge tool

    I have used this tool with no issues up until the other day. I am unaware of what I did but somehow I deselected it and it is no longer a highlighted button that I can select. I am new to photoshop and have tried things to fix it but have been unsucc