Question
· May 15

How to insert data to Third party Database?

hi !

now I want to insert data to third party database directly,  Link Table wizard how to insert  except by sql? 

obj=##class(YBFXJC.LABINFO).%New()
  ;s obj.ID="1"
  obj.HISID="1"
  obj.APPYNO="1"
  obj.HOSPITALID="1"
  obj.BILGDRNAME="1"
  sc=obj.%Save()
  sc_$System.Status.GetErrorText(sc),!

 there is error  <CANNOT SET THIS PROPERTY>zSaveData+3^YBFXJC.TestSaveObj.1

Product version: Ensemble 2016.1
$ZV: 2016
Discussion (4)3
Log in or sign up to continue

I've used Object Script to update linked tables projected as IRIS/Caché classes, like in your sample, since very long time and it works.

As the error says, your issue is that some property/column cannot be set/modified, I'm pretty sure the same issue arise if you use SQL to update/insert the same column.

Without the table definition it's impossible to guess what's the field and why that column cannot be set.
Maybe some of the fields are part of the primary key that includes other fields that are not set?
Make sure that the table is properly linked, the link table wizard sometime need "guidance" on properly linking tables, particularly in defining primary keys...

Anyway, if properly linked, you can definitely treat/manage/manipulate linked tables the same way as native IRIS/Caché  classes.classes.