I have this which I have adapted from 2 other examples, if a person answers male/female then it inserts an adult male/female icon then gives their name and age. this works fine so I have tried to adapt it to give different icons depending on the age of the respondant
{if(p2sex=='M','','')} {INSERTANS:436365X532X2382SQ001_SQ001} {INSERTANS:436365X532X2382SQ001_SQ002} Age {floor((time() - mktime(0,0,0,substr(p2dob,5,2),substr(p2dob,8,2),substr(p2dob,0,4)))/(365.25*24*60*60))}
so in my (probably flawed) logic I thought I would need to get the age first and then the icon so I have
{if{floor((time() - mktime(0,0,0,substr(p2dob,5,2),substr(p2dob,8,2),substr(p2dob,0,4)))/(365.25*24*60*60))}>=17(p2sex=='M','','')} {INSERTANS:436365X532X2382SQ001_SQ001} {INSERTANS:436365X532X2382SQ001_SQ002} Age {floor((time() - mktime(0,0,0,substr(p2dob,5,2),substr(p2dob,8,2),substr(p2dob,0,4)))/(365.25*24*60*60))}
then
{if{floor((time() - mktime(0,0,0,substr(p2dob,5,2),substr(p2dob,8,2),substr(p2dob,0,4)))/(365.25*24*60*60))}<=16(p2sex=='M','','')} {INSERTANS:436365X532X2382SQ001_SQ001} {INSERTANS:436365X532X2382SQ001_SQ002} Age {floor((time() - mktime(0,0,0,substr(p2dob,5,2),substr(p2dob,8,2),substr(p2dob,0,4)))/(365.25*24*60*60))}
but I get an error on the "IF" it is red and so is the last } at the end of the the first floortime in each statement
hopefully this makes sense? any ideas what I have done wrong
The topic has been locked.