如何在一个textField中显示多个字段值 [英] How to show several fields values in one textField
问题描述
可以帮助在一个字段中添加多个数据库字段值。
Can nay one help to add multiple DB field values in one field.
假设我有3个数据库字段:
Say i have 3 DB fields:
Name
Address
Age
我想在同一字段中显示所有3个字段:
I want to display all 3 fields in the same field:
John Peter 28.
我尝试过彼此相邻的3个字段,它确实有效,但是当我换文本时。它看起来非常糟糕:
I tried doing 3 fields next to each other and it did work but when i wrap text. It looks really bad:
名称
Jo.pe.28
hn te
r
我的要求是显示一个文本字段中的数据,例如: John.Peter.26
My requirement is show data in one text field, for example: John.Peter.26
推荐答案
如果你想要把它们放在一行(我猜是这样的),直截了当。
If you want to put them in one line (which i guess is the case), its straight forward.
把它作为一个文本框 $ F {Name} +。 + $ F {地址} +。 + $ F {Age} .toString()
或者你可以使用字符串连接(我个人不喜欢语法,需要付出更多努力理解) $ F {Name} .concat(。)。concat($ F {Address})。concat(。)。concat($ F {Age})
Or you can use string concatenation (I dont personally like the syntax, take more effort to understand) $F{Name}.concat(".").concat($F{Address}).concat(".").concat($F{Age})
这篇关于如何在一个textField中显示多个字段值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!