Relation Between State Field & City Field

When we select any state from a drop down box its respective cites should be listed in city drop down box.

Part A    :       In itially we have to create a Basic table to insert City and state information..
Step 1:      Creation of fields   State(translate field) and city fields
Step 2:     create and build a record using above two fields  using following settings                                                                       state(Key,Search Key ,Listbox Item)         city(Key,Search Key ,Listbox Item).     And name it as   PS_Region_tbl.
Step3:   Creation of Region Page to insert state and city information  in to database.
Step4 :Creation of component and menu….
Part B   :     Now create a Employee Record and include above two fields(city,State)
Step1:  State (translate)
City (Prompt edit table)      
Step2:  Following peoplecode in State FieldChange Event to display the full name of state in emp record,State long name since we aare using Translate field so by default short name is recoreded in employee table,If we need to record Longname of a State then following code will auto record the full name in other field as description field.        
&state = IS_EMP_ADD_TBL.IS_STATE.Value;
&fld = "IS_STATE";
SQLExec("Select XLATLONGNAME from PSXLATITEM WHERE FIELDNAME =:1 AND FIELDVALUE =:2", &fld, &state, &statelong);
IS_EMP_ADD_TBL.IS_DESC.Value = &statelong;
Step3: Insert two  drop down list box in to the page one for State and another for City
Step4:  State Page field Properties
       
Step5:  City Page field Properties
Note:  For this processing the Page processing should be in Active mode,since for every change in State field it should reflect the City field so every time change made in state field application sould make a trip to data base.
In Page properties  uncheck  Allow Deffered processing  tab

3 comments:

  1. its very help full ...
    thanks dear..

    ReplyDelete
  2. State(translate field).
    What are the trnslate values need to define and why you place two fields in scroll.

    Sudhir.

    ReplyDelete