Dynamic list from multi columns
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 81
- Joined: Thu Jul 30, 2015 12:44 pm
Dynamic list from multi columns
Is there a way to create a Dynamic list from multiple columns of DB table? i.e ID+Name? Just as a Display value?
0 x
- dvanhussel
- Ebase User
- Posts: 161
- Joined: Fri Oct 19, 2007 12:45 pm
- Location: Haarlem, the Netherlands
Hi azaleas,
You can do this with a custom list. For example, something like this.
This assumes that the user data is fetched into a table called USERS:
The list will contain the ID as fieldvalue and a concatenation of the ID and USERNAME as displayvalue. The list is associated with the field USERDROPDOWN.
Regards,
David
You can do this with a custom list. For example, something like this.
This assumes that the user data is fetched into a table called USERS:
Code: Select all
var userTable = tables.USERS;
var users = fields.USERDROPDOWN.createCustomList();
userTable.fetchTable();
var rows = userTable.getRows();
while(rows.next()){
var usernameDisplay = userTable.ID.value + ' - '+userTable.NAME.value ;
users.add(usernameDisplay, userTable.ID.value);
}
Regards,
David
0 x
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
Or you could do it by concatenating fields in the select statement of the Dynamic List e.g.
Contatenation is DB specific so you would need to check the exact syntax for your DB.
Code: Select all
select concat(name, id) as displaycol
0 x
-
- Ebase User
- Posts: 81
- Joined: Thu Jul 30, 2015 12:44 pm
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
MySQL supports the concat function. With assisted SQL, you should have something like this in the Select columns box:
where customer_id and name are the columns you want to concatenate. Then add a list field named CUSTOMER_NAME.
Code: Select all
concat(customer_id, ' ', name) as CUSTOMER_NAME
0 x
Who is online
Users browsing this forum: No registered users and 13 guests