Default Set in calc element

mk13

New Member
I learned that when we specify a number of the php array, we should set a spacing like [ x ] rather than set [x] in the default set as rule .

Otherwise I wanted to know that ' &&, || ' was needed whether a kind of rule or not.

This is working and Return the value:
if ('{list___element1}' >=0) {return '123t';}

But this does not work , means Does not Return the value :
if ('{list___element1}' >= 0 && '{list___element1}' =< 9) {return '123';}

related :http://fabrikar.com/forums/showthread.php?t=26575&page=3
 
Should do.
What "doesn't work"?
If your condition fails it's returning nothing, add something like
return 'yyy';
 
this code should return the '123'
But this does not work , means Return nothing of the value :
if ('{placeholder}' >= 0 && '{placeholder}' =< 9) {return '123';}
 
&& is working on my site.
What is your "placeholder"?
You can check your "placeholder" with e.g.
Code:
$p=(int)'{placeholder}';//if your are testing against integers you should cast to type int
var_dump($p);exit;
if ($p >=0 && $p<=9)
{return '123';} 	
else
{return 'abc';}
 
naha, the value(birthday element) casting was string(1) "8". So, I think I should change it to integer...
 
I have a certain that '(int)' converts to integer of cast (on var dump). however the due value isn't returned.
Then I have tested on Calc element and Display element, and the result was same thing.(On calc element test, I have cut the method for storing. )

the code is :
Code:
$dob = "{db_persons___birthday}";
$dobstamp = strtotime($dob);
$age = date('Y') - date('Y', $dobstamp);
if (date('md') < date('md', $dobstamp)) {
$p=$age;
}
$db = JFactory::getDBO();
$id = '{db_persons___id}';
$query = "UPDATE db_persons SET age = '$age' WHERE id = '$id'";
$db->setQuery($query);
$result = $db->query();

[B]$p=(int)'{db_persons___age}';
if ($p>=0 && $p=<50){return '0-9';}
else[/B]{return 'NG';}
 
We are in need of some funding.
More details.

Thank you.

Staff online

Back
Top