简体   繁体   English

浏览值更改期间字符串值突然更改

[英]sudden change in string value during a browse value change

During a Value-Change inside a browse, my string value suddenly changes, specifically the string(9) will change to string(0). 在浏览内进行Value-Change期间,我的字符串值突然更改,特别是string(9)将更改为string(0)。

sample: 样品:

in my combo-box, i used a list-item-pair with following code: 在组合框中,我使用了带有以下代码的列表项对:

cb-name:LIST-ITEM-PAIRS = ?.
cb-name:DELIMITER = '?'.
FOR EACH employee WHERE employee.date-resigned = ? NO-LOCK BY employee.employee-no.
    cb-name:ADD-LAST(TRIM(STRING(employee.employee-no, '99999999') + " - " + employee.last-name + ", " + employee.first-name + " " + SUBSTRING(employee.middle-name,1,1)) + ".",employee.employee-no).
END.
cb-name:SCREEN-VALUE = cb-name:ENTRY(1).

in the value-changed of browse: 在浏览器的价值变化中:

ASSIGN cb-name:SCREEN-VALUE = 
STRING(TRIM(STRING(employee.employee-no, '99999999') + " - " + employee.last-name + ", " + employee.first-name + " " + SUBSTRING(employee.middle-name,1,1)) + "." , 
       STRING(employee.employee-no, '99999999')).

if the employee no has a string value of 9, progress will change it to 0.. producing an error message that has an invalid value.. 如果employee no的字符串值为9,则进度会将其更改为0。.生成一条错误消息,其中包含无效的值。

ex: from 819001 /*correct*/ to 810001 /*incorrect*/

if there is no string(9), it will display like:818002 如果没有字符串(9),它将显示为:818002

if i message the STRING(employee.employee-no, '99999999')), it will display the correct string value 如果我向STRING消息(employee.employee-no,'99999999')),它将显示正确的字符串值

Version doesn't matter in this case, apparently. 在这种情况下,版本无关紧要。 I just simulated it in 10.2B08 using a temp-table with the named tables. 我刚刚在10.2B08中使用带有命名表的临时表对其进行了仿真。 The problem is when you're assigning the screen-value to the combo you're trying to convert the whole string (employee-no + names + separators) into format 99999999. Since your combo is list-item-pairs ('Whatever I want it to display','the real value', 'and so on display' , 'and so forth value') your solution is to assign the screen value just to the real value, disregard the label. 问题是,当您将屏幕值分配给组合时,您正在尝试将整个字符串(员工编号+名称+分隔符)转换为格式99999999。由于您的组合是列表项对(“无论我如何希望它显示”,“实际值”,“等等显示”,“等等值”),您的解决方案是将屏幕值仅分配给实际值,而不必考虑标签。 In other words, as simple as changing your value-changed code to 换句话说,就像将您的价值变更代码更改为

ASSIGN cb-name:SCREEN-VALUE = STRING(employee.employee-no, '99999999') .

It worked for me. 它为我工作。 Let me know if you are still having trouble with it. 让我知道您是否仍然遇到麻烦。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM