Announcement

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

    Date object translation DS vs RPC

    I have a field in the datasource defined as a DATE and when it is fetched via the DS we return a java Date object and I see in the SmartClient Developer Console it gets translated to a LogicalDate via isc.DateUtil.createLogicalDate. All good works great!

    I have the case that under certain RPC calls I need to return the same record back as part of the response so the java Date object does not go through this translation. This I understand since the RPC call is not tied to a datasource and hence there is nothing relating that field as a Date field, it is just "data".

    Is there anyway on the client that I can "apply" the proper translations? That is, in the client I have created a record from the returned data from the RPC call and would like it to be associated to the datasource and have the same processing occur that happens when the record is fetched via a ds.fetch.

    Or should I somehow be returning this as a LogicalDate from the server (if that is even possible)?

    Here is the SDC return info from the rpc call:
    Code:
    {
            status:0, 
            data:{
                status_code:0, 
                response_view:{
                    canDelete:true, 
                    relfreq:1, 
                    ctype:0, 
                    period:false, 
                    version:4, 
                    holiday:false, 
                    canUpdate:true, 
                    name:"foo", 
                    month:0, 
                    dayofweek:1, 
                    day:1, 
                    date:new Date(1413172800000), 
                }
            }
        }
    and here is the ds.fetch response data:

    Code:
                {
                    canDelete:true, 
                    relfreq:1, 
                    ctype:0, 
                    period:false, 
                    version:4, 
                    holiday:false, 
                    canUpdate:true, 
                    name:"foo", 
                    month:0, 
                    dayofweek:1, 
                    day:1
                    date:isc.DateUtil.createLogicalDate(2014, 9, 13), 
                }
    Thanks.

    SmartClient Version: v9.1p_2014-08-31/Pro Deployment (built 2014-08-31)

    #2
    It generally makes more sense to frame an RPC as a custom DataSource operation instead, but that is particularly true in your case, since it means the framework would have the schema to do the data transformation you require.

    Comment

    Working...
    X