0

I am using Javascript JSONStore to initialize JsonStore collection in IBM Mobile First Platform 8.0.0. The issue I am facing is below code working fine for some device and for some device is it Giving below error.

01-19 19:49:43.487 11622-11646/com.mobiInspect D/JSONSTORE: JSONStoreLogger.logTrace in JSONStoreLogger.java:197 :: Table schema mismatch for existing collection. 01-19 19:49:43.492 11622-11646/com.mobiInspect D/JSONSTORE: JSONStoreLogger.logTrace in JSONStoreLogger.java:197 :: dispatching action "provision" 01-19 19:49:43.498 11622-11646/com.mobiInspect D/JSONSTORE: JSONStoreLogger.logTrace in JSONStoreLogger.java:197 :: invoking action dispatcher "provision" with parameters: 01-19 19:49:43.501 11622-11646/com.mobiInspect D/JSONSTORE: JSONStoreLogger.logTrace in JSONStoreLogger.java:197 :: dbName=inspectorList 01-19 19:49:43.505 11622-11622/com.mobiInspect D/WebView: evaluateJavascript=cordova.callbackFromNative('LoggerPlugin1661877744',true,1,["OK"],false); 01-19 19:49:43.506 11622-11646/com.mobiInspect D/JSONSTORE: JSONStoreLogger.logTrace in JSONStoreLogger.java:197 :: schema={"name":"string"} 01-19 19:49:43.512 11622-11646/com.mobiInspect D/JSONSTORE: JSONStoreLogger.logTrace in JSONStoreLogger.java:197 :: options=[value not logged] 01-19 19:49:43.515 11622-11646/com.mobiInspect D/JSONSTORE: JSONStoreLogger.logTrace in JSONStoreLogger.java:197 :: additionalSearchFields={} 01-19 19:49:43.519 11622-11646/com.mobiInspect D/JSONSTORE: JSONStoreLogger.logTrace in JSONStoreLogger.java:197 :: dropCollection=false 01-19 19:49:43.523 11622-11646/com.mobiInspect D/JSONSTORE: JSONStoreLogger.logTrace in JSONStoreLogger.java:197 :: username=jsonstore 01-19 19:49:43.529 11622-11646/com.mobiInspect D/JSONSTORE: JSONStoreLogger.logTrace in JSONStoreLogger.java:197 :: collectionPassword=xxxxxxxx 01-19 19:49:43.533 11622-11646/com.mobiInspect E/null: Initialization failure on : Task List Collection {"src":"initCollection","err":-2,"msg":"PROVISION_TABLE_SEARCH_FIELDS_MISMATCH","col":"myTasks","usr":"jsonstore","doc":{},"res":{}} 01-19 19:49:43.535 11622-11646/com.mobiInspect E/wl.jsonstore: {"src":"initCollection","err":-2,"msg":"PROVISION_TABLE_SEARCH_FIELDS_MISMATCH","col":"myTasks","usr":"jsonstore","doc":{},"res":{}} 01-19 19:49:43.753 11622-11633/com.mobiInspect I/art: Background sticky concurrent mark sweep GC freed 41582(2MB) AllocSpace objects, 0(0B) LOS objects, 10% free, 15MB/17MB, paused 3.657ms total 148.294ms 01-19 19:49:43.768 11622-11646/com.mobiInspect D/wl.response: WLResponse. in WLResponse.java:69 :: Response does not include a Content-Encoding header. Attempting to read response body. 01-19 19:49:43.814 11622-11646/com.mobiInspect D/wl.request: WLRequestSender.run in WLRequestSender.java:43 :: Sending request https://www.serverurl.com/mfp/api/az/v1/token

$scope.init_collection = function () {
    ProgressIndicator.showSimpleWithLabel(false, 'Loading...');

    //Data Collection

    collections1['COLLECTION_NAME'] = {
        searchFields: {'id': 'string', 'processid': 'string', 'state': 'integer'}
    };

    WL.JSONStore.init(collections1, options)
    .then(function () {
        WL.Logger.info("Inside Task Submission Collection");

        WL.JSONStore.fileInfo()
                                .then(function (res) {
                                WL.Logger.debug(" Success response of Task Submission Collection fileInfo :" +JSON.stringify(res));
                                  //res => [{isEncrypted : true, name : carlos, size : 3072}]
                                })

                                  .fail(function (failRes) {
                                  WL.Logger.debug("Failure response of Task Submission Collection fileInfo :" +JSON.stringify(failRes));
                                  // Handle failure.
                                });
    })
    .fail(function (errorObject) {
        //WL.Logger.error(Messages.ERR_LGN_FAIL_INI_DTA_STRG);
        WL.Logger.error("Initialization failure on : Task Submission Collection "+JSON.stringify(errorObject));
    });
    //WL.Logger.info(Messages.INF_LGN_INI_DTA_STRG);
    //Data Collection

    //Image Collection

    collections2["COLLECTION_IMAGE"] = {
        searchFields: {'id': 'string', 'processid': 'string', 'isImageSubmitted': 'boolean'}
    };

    WL.JSONStore.init(collections2, options)
    .then(function () {
        WL.Logger.info("Inside Image Submission Collection");

        WL.JSONStore.fileInfo()
                                    .then(function (res) {
                                    WL.Logger.debug(" Success response of Image Submission Collection fileInfo :" +JSON.stringify(res));
                                      //res => [{isEncrypted : true, name : carlos, size : 3072}]
                                    })

                                      .fail(function (failRes) {
                                      WL.Logger.debug("Failure response of Image Submission Collection fileInfo :" +JSON.stringify(failRes));
                                      // Handle failure.
                                    });
    })
    .fail(function (errorObject) {
        //WL.Logger.error(Messages.ERR_LGN_FAIL_INI_IMG_CLL);
        WL.Logger.error("Initialization failure on : Image Submission Collection "+JSON.stringify(errorObject));
    });
    //WL.Logger.info(Messages.INF_LGN_CLL_INI);

    //Image Collection


    //TODAY Collection

    collections3["COLLECTION_TODAY"] = {
        searchFields: {'id': 'string', 'processid': 'string', 'state': 'integer', 'insname': 'string'}
    };
    WL.JSONStore.init(collections3, options)
    .then(function () {
        WL.Logger.info("Inside Task List Collection");

        WL.JSONStore.fileInfo()
        .then(function (res) {
            WL.Logger.debug("Success response of Task List Collection fileInfo :" +JSON.stringify(res));
                                      //res => [{isEncrypted : true, name : carlos, size : 3072}]
        })
        .fail(function (failRes) {
            WL.Logger.debug("Failure response of Task List Collection fileInfo :" +JSON.stringify(failRes));
            // Handle failure.
        });
    })
    .fail(function (errorObject) {
        //WL.Logger.error(Messages.ERR_LGN_FAIL_INI_IMG_CLL);
        WL.Logger.error("Initialization failure on : Task List Collection "+JSON.stringify(errorObject));
    });
    //WL.Logger.info(Messages.INF_LGN_CLL_INI);

    //TODAY Collection

    //List Collection
    collections4["COLLECTION_LIST"] = {
        searchFields: {'name': 'string'}
    };
    WL.JSONStore.init(collections4, options)
    .then(function () {
        WL.Logger.info("Inside Inspector List Collection");

        WL.JSONStore.fileInfo()
        .then(function (res) {
            WL.Logger.debug("Success response of Inspector List Collection fileInfo :" +JSON.stringify(res));
                                      //res => [{isEncrypted : true, name : carlos, size : 3072}]
        })
        .fail(function (failRes) {
            WL.Logger.debug("Failure response of Inspector List Collection fileInfo :" +JSON.stringify(failRes));
            // Handle failure.
        });
    })
    .fail(function (errorObject) {
        //WL.Logger.error(Messages.ERR_LGN_FAIL_INI_IMG_CLL);
        WL.Logger.error("Initialization failure on : Inspector List Collection " +JSON.stringify(errorObject));
    });
    WL.Logger.info(Messages.INF_LGN_CLL_INI);
    //List Collection

};

Am I missing anything here for JsonStore Initialization in IBM MFP 8.0? Any help would be appreciated.

kaushik parmar
  • 805
  • 6
  • 19

1 Answers1

0

Error msg 'PROVISION_TABLE_SEARCH_FIELDS_MISMATCH' can occur when

Search fields are not dynamic. It is not possible to change search fields without calling the destroy method or the removeCollection method before you call the init or openmethod with the new search fields. This error can occur if you change the name or type of the search field. For example: {key: ‘string’} to {key: ‘number’} or {myKey: ‘string’} to {theKey: ‘string’}.

See here for more details : http://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/troubleshooting/jsonstore/

  • Hi, The issue is with some device only. It is working fine with real devices or simulators but giving error PROVISION_TABLE_SEARCH_FIELDS_MISMATCH for few devices. This is random issue. We have followed your given reference but still issue persist. – kaushik parmar Jan 22 '18 at 05:09
  • Can you specify on which all devices and android vesrions you are seeing issue ? – manjunath kallannavar Jan 22 '18 at 06:15
  • we are facing this issue in Pixel XL Android API 25 , 26 and 27. We are doing testing of application on real Google Pixel Devices. – kaushik parmar Jan 22 '18 at 11:33
  • I had successfully tested JSON store sample app in Pixel android 25 and 26.Share your app in which issue is seen,I will test with my pixel device and will see what's blocking your app to run on pixel device. – manjunath kallannavar Jan 22 '18 at 12:16
  • Are you modifying or adding new search fields to the existing collection's search fields. – manjunath kallannavar Jan 23 '18 at 06:46