INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Need expression nesting help  (Read 1256 times)

kensn

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1362
Need expression nesting help
« on: November 29, 2013, 01:12:39 pm »

ifelse(!isempty([My Field 1]), Some Text [My Field 1] if(!isempty([Disc #]), - Disc #[Disc #]), !IsEmpty(([My Field 2]), Some Text [My Field 2] if(!isempty([Disc #]), - Disc #[Disc #]), !isempty([Disc #]), Disc #[Disc #]))

So if [My field 1] is not empty, I would like to show "Some Text [My Field 1] and if [Disc #] is not empty I would like to show it also, same with [My Field 2], or if they are both empty just show the Disc #.

Cant get the syntax.

Ken
Logged
If(IsEmpty([Coffee Cup]), Coffee, Drink)

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: Need expression nesting help
« Reply #1 on: November 29, 2013, 04:41:42 pm »

i think it is more helpful to copy the code you use and put it here.. :b but for now i would say the ( just before using [my field 2] breaks the ifelse thing. and if so take the ) at the end away.

 :)
gab

edit: or just change the ifelse in if?
Logged

RJC

  • Junior Woodchuck
  • **
  • Posts: 56
Re: Need expression nesting help
« Reply #2 on: November 29, 2013, 04:58:38 pm »

If you want to do ANDs and ORs you could try the Math() function:

IfElse(
Math(Compare([Watched], =, 1) & Compare([Number Plays], >, 0)), Watched,
Math(Compare([Watched], =, 0) | Compare([Number Plays], =, 0)), Unwatched,
Math(Compare([Watched], =, 1) & Compare([Number Plays], =, 0)), Special Case,
Math(Compare([Watched], =, 0) | Compare([Number Plays], >, 0)), Started
)
Logged

6233638

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 5353
Re: Need expression nesting help
« Reply #3 on: November 29, 2013, 05:28:34 pm »

I think you should be using delimit() rather than if statements.
 
e.g.

Code: [Select]
if(!isempty([My Field 1]),
Some Text [My Field 1]delimit([Disc #],,/ -/ Disc/ #),
if(!isempty([My Field 2]),
Some Text [My Field 2]delimit([Disc #],,/ -/ Disc/ #),
Disc #[Disc #]))
Logged

kensn

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1362
Re: Need expression nesting help
« Reply #4 on: November 29, 2013, 09:38:49 pm »

Thanks for all the ideas, I went with the delimit solution as I was trying that already, just could not get the syntax. Will work out what all the / do.

Thanks again..

ken
Logged
If(IsEmpty([Coffee Cup]), Coffee, Drink)
Pages: [1]   Go Up