Midwest User Group

 View Only
  • 1.  EDS Implementation For Multiple fields.

    Posted Thu May 18, 2023 01:35 PM

    We have a user case where we are looking to incorporate EDS into some of our Navigator Entry Templates.
    We have several cases where an initial value would be populated, which can then return 1 value or several values. We would need fields populated based on the combination of the 2 input fields (when there is more than 1 value returned from the initial entry).
    Is it possible to stack fields for results based on 2 users selections that were EDS driven fields.
    Field 1 is a open text field. user tabs out and a second field (drop down list) is populated with the results based on the first text field.
    User then selects the option in the second field (drop down list) which would then populate multiple fields based on the combination of the 2 fields together's input data.

    Is ths possible to use or can EDS only use the latest field to populate next layer fields?

    Liz Valenta

  • 2.  RE: EDS Implementation For Multiple fields.

    Posted Wed May 24, 2023 11:38 PM
    Yes, the EDS can do that. There are some differences in the sample EDS service to achieve this:
    1. Property A and B are marked as hasDependentProperties. Then changing any of them will trigger EDS call to the EDS service
    2. When EDS gets the request, there will be a "properties" JSON data containing all property values from the ICN page. Then the EDS service can return as:
    1. If A has a value and B has not, return values/choices for B
    2. If A has a value and B has a value, return other values according to it.
    3. The sample EDS Service uses a propertyData from JSON file to do this, but actually, how to return data depends on the service logic, not only from the JSON file.
    Here is an additional logic I tried with Book_PropertyData.json from the sample EDS service.
    a. A Book class to CPE with String property Author and String property Title
    b. Add "hasDependentProperties":true to all DocumentTitle definitions in json File
    c. In EDS service  UpdateObjectTypeServlet.java add logic before sending a response json. The Title will be set to "Got it" after Author is set to "George Martin" and DocumentTitle is set to "A Game of Thrones".
                String authorValue = "";
    			String documentTitle = "";
    			for (int j = 0; j < requestProperties.size(); j++) {
    				JSONObject requestProperty = (JSONObject)requestProperties.get(j);
    				String name = String.valueOf(requestProperty.get("symbolicName"));
    				String value = String.valueOf(requestProperty.get("value"));
    				if( name.equals( "Author" ) ) {
    					authorValue = value;
    				}else if( name.equals( "DocumentTitle" ) ) {
    					documentTitle = value;
    			if( authorValue.equals( "George Martin" ) && documentTitle.equals( "A Game of Thrones" ) ) {
    				JSONObject title = JSONObject.parse( "{\"symbolicName\":\"Title\",\"value\":\"Got it\"}" );
    				responseProperties.add( title );