Write to multiple DSE returning empty CDT instead of null.

Certified Associate Developer

We are using Write to Multiple Data Store Entity smart service to write multiple Process variables at once ( In that couple of Process Variables are null. ). After writing to DB in output we are trying to get data written back to PV using ac!storedValues.  

However even though PVs are null, after writing to DB it is returning empty CDT instead of null.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Associate Developer
    in reply to Stefan Helzle

    Yes correct,

    If we use ac!StoredValues[1].data, it will work.

    But, As there are too many PVs we are writing in one Write to multiple DSE smart service, we are using reduce function (Please refer code below.) to get data back to respective PV after writing to DB in output instead of ac!StoredValues[1].data format.

    Issue is, As PV is null initially, after writing to DB we should get as null into PV. However we are receiving as empty [Please refer Screenshot]

    Usually we get as (No Value ) if any variable is null, however after writing to DB and getting result back using reduce function we are getting blank value.

    Impact: Because of user input task is getting it as empty CDT and grid is throwing error.

    reduce(
      rule!ACO_getDataFromEntityDataForEntity,
      {},
      ac!StoredValues,
      cons!CLO_DSE_GRID_GUARANTOR_INFO
    )
    
    rule!ACO_getDataFromEntityDataForEntity reads as below
    append(
      ri!data,
      if(
        ri!EntityData.entity = ri!Entity,
        ri!EntityData.data,
        {}
      )
    )
    

  • 0
    Certified Lead Developer
    in reply to riyazn

    As you already use an expression to extract the values, why not add a NULL/Empty check and return the values as needed.