Announcement

Collapse
No announcement yet.

[SOLVED] automatic data into another field

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [SOLVED] automatic data into another field

    I wondered if anyone can help me, i'm new to scriptcase and learning.

    I have a two tables lets say table 1 and table 2.

    Table 1 has two fields a description of a item and a weight of a item.

    Table 2 I have created a drop down list from the first field in table 1 (description) working fine.


    the problem i'm trying to solve is how in scripcase do I automatically put the weight of the item selected into a field in table 2?

  • #2
    I assume you have a form on table 2. The field which refers to the table 1 needs to be of type select. In the lookup you specify the key and description. On the form the description is shown, but in the database the keyvalue will be stored. So actually you don't have to do a thing if you have already succeeded in creating the lookup.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      my problem is this how do I get another field in the table to show a value from the select drop down? ie in table 2 the user selects the container type and when they do that i want the weight to be displayed in another field. table 1 contains the information for container type and weight, table 2 is going to be doing a calculation from the data my warehouse staff enter.

      Comment


      • #4
        It's probabely me, but I don't quite understand what you want to do. If you want to fill other fields when a field changes you can define an ajax event on the changing field and in the event you can change the content of another field. Due to the fact that it's done by ajax, your webform will not refresh, just the field. Is that what you want to do?
        Albert Drent
        aducom software netherlands
        scriptcase partner, reseller, support and (turn-key) development
        www.scriptcase.eu / www.scriptcase.nl

        Comment


        • #5
          Yes this is what I want to do, please can you explain a little more.

          thanks

          Comment


          • #6
            create a container type onChange event
            sc_lookup(dataset, "SELECT weight
            FROM xxxxxx
            WHERE xxxxxx.container_type='{container_type}'");

            {weight}= {dataset[0][0]};

            Comment


            • #7
              Ok im new to this, i sort of get the idea, but dont know where to put the fields in this code above.

              table 1 is mdi_containers fields are container_disc and container_weight.

              table 2 is named inbound_items fields are inbound_container (as a select drop down from table field container_disc) and inbound_container_weight.

              Comment


              • #8
                this is what i have tried, but not working :-(

                sc_lookup(dataset, "SELECT container_weight
                FROM mdj_containers
                WHERE mdj_containers.container_disc='{inbound_container} '");

                {container_weight}= {dataset[0][0]};

                Comment


                • #9
                  sc_lookup(dataset, "SELECT container_weight
                  FROM mdj_containers
                  WHERE mdj_containers.container_disc='{inbound_container} '");

                  {inbound_container_weight}= {dataset[0][0]};

                  Comment


                  • #10
                    Thanks Frankotse, working perfectly.

                    Comment

                    Working...
                    X