Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Can anybody help me to understand how to set multiple criteria in server script?

    It is clear to set only 1 criteria for DSRequest using setCriteria(field, value).
    However I can't seem to find a way to set 2 criterias in ds.xml. I have tried Map with no success. Here is my code.
    Please anybody let me know where I am wrong...
    ----
    <script language="groovy">
    if (dsRequest.getOperationType() == Datasource.OP_ADD ) {
    DSRequest dsReq_languages = new DSRequest("s110_languages","fetch");
    dsReq_languages.setOperationId("LanguagesNotRegistered");
    dsReq_languages.setRPCManager(dsRequest.getRPCManager());
    Map<String,String> map = new HashMap<String,String>();
    map.put("screen_code",dsRequst.getFieldValue("screen_code").toString());
    map.put("language_key",dsRequst.getFieldValue("language_key").toString());
    dsReq_languages.setCriteria(map);
    DSResponse dsRes_languages = dsReq_languages.execute();

    }else if (dsRequest.getOperationType() == Datasource.OP_REMOVE) {

    }



    return dsRequest.execute();
    </script>

    #2
    There's nothing wrong with that part of the request, but criteria you set can be dropped if, for example, your s110_languages DataSource does not declare one of those fields. Take a look at your server logs to see what's going wrong, and if you need more help, first take a look at the FAQ - you have forgotten to post several required bits of information.

    Comment


      #3
      Thanks Isomorphic for quick reply.
      I feagured out I was missing CDATA. I had to use this since there is special characters in the code.

      <![CDATA[
      if (dsRequest.getOperationType() == "add" ) {
      DSRequest dsReq_languages = new DSRequest("s110_languages","fetch");
      dsReq_languages.setOperationId("LanguagesNotRegistered");
      dsReq_languages.setRPCManager(dsRequest.getRPCManager());
      HashMap<String,String> map = new HashMap<String,String>();
      map.put("language_key",dsRequst.getFieldValue("screen_code").toString());
      map.put("language_desc",dsRequst.getFieldValue("text_code").toString());
      dsReq_languages.setCriteria(map);
      DSResponse dsRes_languages = dsReq_languages.execute();

      };


      return dsRequest.execute();
      ]]>

      Comment

      Working...
      X