表达式或赋值中的数据类型不兼容

问题描述 投票:0回答:1

我打算在进度站点(ABL)上编写一个API,但是当我尝试编译它时,我收到此错误:

表达式或赋值中的数据类型不兼容。 (223)
无法理解第 77 行。(196)

77 号线从这里开始:

Assign AlertDetail.AlertId = Alert_Popups.AlertID
AlertDetail.AlertType = Alert_Popups.Alert_Type
AlertDetail.AlertUTCDateTime = if Alert_Client_Acknowledgement.AlertDateTime = ? then now else Alert_Client_Acknowledgement.AlertDateTime
AlertDetail.lTimeZone = lv_timeZoneDescription
AlertDetail.lTimeZoneoffset = lv_timeZoneOffset
AlertDetail.PropertyId = integer(Alert_Popups.propertyid)
AlertDetail.PropertyName = cPropertyname
AlertDetail.Alerts_id = RECID(Alert_Popups)
AlertDetail.AlertStatus = if Alert_Client_Acknowledgement.noack = "NoAck" then "AlertAcknowledged" else "AlertGenerated"
AlertDetail.Comment = Alert_Client_Acknowledgement.Acking_Text
AlertDetail.AlertAttribute = Alert_Desktop_Config_Details.Alert_attribute
AlertDetail.AlertDisplayString = ? /* to do: Initialize as a blob */
AlertDetail.AlertImageName = Alert_Desktop_Config_Details.Alert_Image_name
AlertDetail.AlertPriority = Alert_Desktop_Config_Details.Alert_priority
AlertDetail.AlertSoundName = Alert_Desktop_Config_Details.Alert_Sound_Name .

copy-lob from Alert_Desktop_Config_Details.Alert_verbiage to AlertDetail.AlertDisplayString.
copy-lob from AlertDetail.AlertDisplayString to ggDisplayString.

/* Replace variables with data */
run ReplaceVariablewithData(ggDisplayString, AlertDetail.AlertId, OUTPUT ggDisplayString).
copy-lob from ggDisplayString to AlertDetail.AlertDisplayString.

我希望代码能够在 GUI 程序编辑器中成功编译。

openedge progress-4gl abl
1个回答
0
投票

您的代码示例不完整,您的帖子没有告诉我们任何数据类型实际上是什么。尽管如此,出于调试目的,您可以通过将批量 ASSIGN 替换为单独的分配来缩小错误范围,如下所示:

AlertDetail.AlertId = Alert_Popups.AlertID.
AlertDetail.AlertType = Alert_Popups.Alert_Type.
AlertDetail.AlertUTCDateTime = if Alert_Client_Acknowledgement.AlertDateTime = ? then now else Alert_Client_Acknowledgement.AlertDateTime.
AlertDetail.lTimeZone = lv_timeZoneDescription.
AlertDetail.lTimeZoneoffset = lv_timeZoneOffset.
AlertDetail.PropertyId = integer(Alert_Popups.propertyid).
AlertDetail.PropertyName = cPropertyname.
AlertDetail.Alerts_id = RECID(Alert_Popups).
AlertDetail.AlertStatus = if Alert_Client_Acknowledgement.noack = "NoAck" then "AlertAcknowledged" else "AlertGenerated"
AlertDetail.Comment = Alert_Client_Acknowledgement.Acking_Text.
AlertDetail.AlertAttribute = Alert_Desktop_Config_Details.Alert_attribute.
AlertDetail.AlertDisplayString = ?. /* to do: Initialize as a blob */
AlertDetail.AlertImageName = Alert_Desktop_Config_Details.Alert_Image_name.
AlertDetail.AlertPriority = Alert_Desktop_Config_Details.Alert_priority.
AlertDetail.AlertSoundName = Alert_Desktop_Config_Details.Alert_Sound_Name.

IOW 删除 ASSIGN 并添加一个“.”在每行的末尾。这将告诉您哪条特定线路导致了问题。 (一旦你弄清楚了,再回到批量 ASSIGN,它具有性能优势。)

看看它,在不知道表中定义的实际数据类型的情况下,我认为最有可能的候选者是 RECID(alert_popups) 与alerts_id 不兼容 - 猜测alerts_id 是 INTEGER 或 INT64 (您需要包装 INTEGER( ) 或 RECID() 周围的 INT64() 函数就是这种情况。或者,如果alerts_id 是字符字段,则需要 STRING() 函数。

话虽如此……出于某种原因,您在下面添加了那些 COPY-LOB 语句,它们看起来也很可疑。如果这些 COPY-LOB 语句中的字段是 CHARACTER 而不是 LONGCHAR,那也将是一个错误。尽管在这种情况下,错误应该是“COPY-LOB 仅适用于大对象字段。(11285)”

copy-lob from Alert_Desktop_Config_Details.Alert_verbiage to AlertDetail.AlertDisplayString.
copy-lob from AlertDetail.AlertDisplayString to ggDisplayString.

/* Replace variables with data */
run ReplaceVariablewithData(ggDisplayString, AlertDetail.AlertId, OUTPUT ggDisplayString).
copy-lob from ggDisplayString to AlertDetail.AlertDisplayString.
© www.soinside.com 2019 - 2024. All rights reserved.