【问题标题】:JSONStore push() gives "Data conversion error"JSONStore push() 给出“数据转换错误”
【发布时间】:2015-03-01 05:06:03
【问题描述】:

我正在使用 MobileFirst Platform 6.3.0.00-20141218-1823。

使用如下 JSONStore 推送代码 sn -p 返回错误:

Procedure invocation error. Runtime: Data conversion error converting "{""FIRSTNAME"":""abcd"",""CONTACTNO"":9090909099,""ID"":2,""EMAIL"":""abcd@gmail.com"",""LASTNAME"":""xyz""}"; SQL statement:
delete from addressbook where id=? [22018-184].
Performed query:
delete from addressbook where id=?

代码:

WL.JSONStore.get(collectionName).countAllDirty().then(function(numberOfDirtyDocs){
    if(numberOfDirtyDocs > 0){
        WL.JSONStore.get(collectionName).push().then(function(){
            deferred.resolve(true);
        }).fail(function(errorObject){
            deferred.reject(false);
        });
        deferred.resolve(numberOfDirtyDocs);
    }else{
        deferred.reject(numberOfDirtyDocs);
    }
}).fail(function(errorObject){
    deferred.reject(errorObject);
})

如何调试它以找到解决方案?

【问题讨论】:

  • 1) 始终提及您的 Worklight 版本和内部版本号。 2) 编辑问题并提供您的应用程序的 JSONStore 推送实现,该实现会给出错误。
  • 能够正确获取脏文档的数量,但是当我尝试推送时,我得到了提到的错误。

标签: jsonstore ibm-mobilefirst


【解决方案1】:

我发现问题出在我的适配器代码中。我不得不

JSON.parse(input object)

在我的适配器代码中。我还需要对 json 对象中的键使用大写。

【讨论】:

    猜你喜欢
    • 2016-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多