Add/Update Action not writing to DSE

New designer here; I've created an Action to Add or Update reference data but it is not writing to the database as it should. In monitoring the process it appears to run correctly, but nothing appears in the database. Any help would be appreciated!

OriginalPostID-272969

  Discussion posts and replies are publicly visible

Parents
  • Hi @bryant.st39 and aloks176, thanks for the suggestions. I do think the PV is null - the Alert I keep getting now is attached. I'm not sure how to try using the index function suggested by aloks176 but could you explain what you mean by "do some null handling to see if the PV is null to avoid this error"? I know the PV is null but not how to fix it. "id" is a part of the CDT called "RefData" and although it doesn't display the ID on the Action interface, it should add a new one or update the associated columns for an existing id.

Reply
  • Hi @bryant.st39 and aloks176, thanks for the suggestions. I do think the PV is null - the Alert I keep getting now is attached. I'm not sure how to try using the index function suggested by aloks176 but could you explain what you mean by "do some null handling to see if the PV is null to avoid this error"? I know the PV is null but not how to fix it. "id" is a part of the CDT called "RefData" and although it doesn't display the ID on the Action interface, it should add a new one or update the associated columns for an existing id.

Children
  • 0
    A Score Level 1
    in reply to sarahk8341

    Hello sarahk8341,

    From the screenshots, I am noting a few points which you need to correct.
    The PV CDT you are trying to write to DB is multiple - it is a multiple CDT (array of CDT). But, in the input of the Write to datastore smart service, it is not multiple. The types should match. The RefData input should be multiple in the Write to datastore smart service input.

    Another thing - somehow your Multiple CDT PV is null.
    You can put a check in your process model - using the XOR gateway. Check if the PV is null. If it is null, do not write to the database.
    Another approach would be to use the "Write to Multiple Datastore " smart service. It would avoid the need for null check. Write to Multiple Datastore simply avoids writing to DB if there is no data to write. In this way, Write to Multiple Datastore is more robust.

    Finally, you also need to pinpoint why the Multiple CDT is null in the first place. Maybe something is not working as expected. You are probably passing the value as parameter(I see that from the screenshot). Check why the value is not getting passed. Is this process model getting called from another process model? Or is it getting called from Related action or a web API?
    Whatever be the mechanism, check why the caller of this process model is not able to pass non-null data. Once you find it, it would help you to fix the issue at the source.

  • A problem with the Write to Multiple Data Store Entity is that, during the monitoring of process, the process properties(the icon that opens the PVs window when clicked) will not work in most cases when we are trying to write to multiple entities and this could be because of the weird value(decoded from the constant that holds reference to Data Store Entity) that will be assigned to 'entity' attribute of type!EntityData() list. This makes the debugging a night mare and we need to go to Process Details dashboard to monitor the PVs.

    In order to overcome this, I am doing the following to make sure that process properties option is working properly:

    1. Save the data from Entity Data into corresponding CDTs.

    2. Set the entity fields in EntityData PV to null or Set the entire EntityData PV to null.

  • Hi @chetany, thanks for your reply. I adjusted the Write to Datastore Input - RefData to Multiple as you suggested. I'm still not sure why the PV is null -- in the Process Properties, the ReferenceData Variable has nothing for "Value" (See screenshot attached) but I don't think it needs a default value? I de-selected it as a Parameter since I'm not sure it needs to be one. This process is not getting called from any other process model or related action - only the original action that I created called "Add/Update Reference Data" which is a grid form to update or add data to. Each time I try to complete the Action I am adding in data, so the PV "ReferenceData" shouldn't be null?

     

  • 0
    Certified Lead Developer
    in reply to Sarah K.
    I agree with the above. Your pv is most likely null before it ever hits the write to ds smart service. Either remove saving the output to the same pv or store it in a new one so you can see what is getting passed in.
    Then look at the node as to where you expect the pv to get its value. Is it getting a value? The one you expect. Again store that value to a new pv that nothing else touches to see if it gets a value. If it gets a value, something else is clearing it out. If it doesn't then you know the issue is nothing is being written from ACPs to PVs.