Welcome to the nuBuilder Forums!

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

Display values on Edit form

Locked
Tinka
Posts: 73
Joined: Mon Feb 24, 2014 2:58 pm

Display values on Edit form

Unread post by Tinka »

Hi

Simple problem:
I want to display the text "minus" when the field value is 0 and "plus" when 1. On a browse screen it works fine by using

Code: Select all

IF(genpos_strand= "1", "plus", IF( genpos_strand= "0", "minus", " "))
But how can I achieve the same on an edit screen? I played with "Case when" and php function (the field is updated by a lookup).It does not work.

Code: Select all

function FetchStrand() {
//build sql
$sql = "
Select genpos_strand,
    CASE WHEN genpos_strand = '0' THEN 'minus'
       WHEN genpos_strand = '1' THEN 'plus'
       ELSE 'not determined' END AS genpos_strand
FROM genomic_position
";
//run query and fetch results from db
$q = nuRunQuery($sql);
    $r = db_fetch_object($q);
    return $r->genpos_strand;
}

Can I use $('#genpos'.text()) somehow?

Thanks for any hints.

Tinka
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Display values on Edit form

Unread post by admin »

Timka,

If you create a Display Object..
display.PNG
disp2.PNG
Then add these items to a lookup.
disp3.PNG
Hope it makes sense.

Steven
You do not have the required permissions to view the files attached to this post.
Tinka
Posts: 73
Joined: Mon Feb 24, 2014 2:58 pm

Re: Display values on Edit form

Unread post by Tinka »

Steven,

thank you that worked, even with a nested IF in both the display and "update other fields"

Code: Select all

IF(genpos_strand= "1", "plus", IF( genpos_strand= "0", "minus", " "))
Tinka
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Display values on Edit form

Unread post by admin »

thats good news
Locked