Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Lookup Control / return concatenated fields Topic is solved

Questions related to using nuBuilder Forte.
Post Reply
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Lookup Control / return concatenated fields

Unread post by toms »

Hi,

I'm trying to return two concatenated fields from a Browse Form to the description field of a lookup control.

My first attempt was to concatenate the fields directly in the query. Result: The Browse Form stays empty.
concat_sql.PNG
The 2nd attempt: By concatenating the fields in the Display row I can see the field appear on the Browse Form.
contact_display.PNG
Now my question is how I can pass that "fullname" field to the lookup control? Adding an alias for the concatenated fields (like CONCAT(gd_vorname, ' ', gd_nachname) as full_name) doesn't work.
lookup_description.PNG
You do not have the required permissions to view the files attached to this post.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Lookup Control / return concatenated fields

Unread post by admin »

toms,

Try this...
lookup_description.PNG
Steven
You do not have the required permissions to view the files attached to this post.
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Lookup Control / return concatenated fields

Unread post by toms »

Steven,

Thank you, it works like this. Why didn't I think of that...?
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Lookup Control / return concatenated fields

Unread post by admin »

toms,

It will only work with fields from the table connected to the Lookup.

Not fields from any SQL joins.

If you want to do something more complicated, like how much a customer owes.

You could do that with PHP in After Browse.
after_browse.PNG
You could do something like this...

Code: Select all

$lur    = nuLookupRecord();
$i      = $lur->ID;
$s      = "
        SELECT SUM(inv_total) 
        WHERE inv_paid = '0'
        AND inv_customer_id = '$i'
        ";
    
$t      = nuRunQuery($s);
$r      = db_fetch_row($t);

nuSetFormValue('rep_customer_iddescription', "Currently owing : " . $r[0]);

Steven
You do not have the required permissions to view the files attached to this post.
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Lookup Control / return concatenated fields

Unread post by toms »

Steven,

Thanks for the additional example. I've just nuLookupRecord() so far but not in combination with
nuRunQuery() etc.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Lookup Control / return concatenated fields

Unread post by admin »

.
Post Reply