Page 1 of 1

Display values on Edit form

Posted: Tue Jun 03, 2014 10:53 am
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

Re: Display values on Edit form

Posted: Wed Jun 04, 2014 6:27 am
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

Re: Display values on Edit form

Posted: Wed Jun 04, 2014 4:40 pm
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

Re: Display values on Edit form

Posted: Thu Jun 05, 2014 7:08 am
by admin
thats good news