Progress ABL API编译报错:表达式或赋值中数据类型不兼容(223)
Progress ABL编译错误排查与修复
错误信息
Incompatible data types in expression or assignment. (223)
Could not understand line 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.
错误原因与修复方案
1. 语法错误(错误196:无法理解第77行)
ABL的Assign语句多行赋值时,除最后一行外,每行结尾必须用逗号分隔。你的代码中Assign后的字段赋值行没有逗号,导致编译器无法识别正确的语法结构。
修复后的Assign语句:
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.
2. 数据类型不兼容(错误223)
结合代码逐一排查:
now调用错误:ABL中now是函数,必须加括号now(),否则会被识别为未定义变量,引发类型错误。- 字段类型匹配检查:
- 确认
AlertDetail.Alerts_id的类型为整数,与RECID(Alert_Popups)的返回值类型一致。 - 确认
AlertDetail.PropertyId为整数类型,匹配integer(Alert_Popups.propertyid)的转换结果。 - 检查
Alert_Client_Acknowledgement.noack的类型:如果是逻辑型,需修改判断逻辑(如if Alert_Client_Acknowledgement.noack then ...);如果是字符型,确保与字符串"NoAck"的编码、长度匹配。 - 确认
AlertDetail.AlertDisplayString和ggDisplayString均为BLOB类型,保证copy-lob和ReplaceVariablewithData调用时类型兼容。
- 确认
- 未知值初始化:若
AlertDetail.AlertDisplayString是BLOB类型,用?初始化是允许的,但后续需确保copy-lob操作的源字段有效(非?)。
额外检查
- 确认
Alert_Popups、Alert_Client_Acknowledgement、Alert_Desktop_Config_Details等表/临时表已被正确打开(如有必要添加FOR EACH或FIND语句),避免字段引用无效。
内容的提问来源于stack exchange,提问作者Nazmus Sakib
相关产品推荐
相关产品推荐

