INTERACT FORUM

Please login or register.

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

Author Topic: Expression help  (Read 2530 times)

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Expression help
« on: March 28, 2013, 06:14:23 pm »

Need a hand with some expression if anyone can give me, thx.
In the date each time when i don't have a information on month or day, i see on the date field or anywhere else with date, that it appears like this 1/1/year..., so what i want is on the date if i don't have any date info on month/day to appear only year.
Ex1: month=0 day=0 year=2000, date=1972 (not 1/1/2000)
Ex2: month=5 day=1 year=2000, date=5/1/2000
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Date expression
« Reply #1 on: March 28, 2013, 06:31:17 pm »

When you enter a year-only value in the MC [Date] field, only the year will be displayed.  It is not possible to have MC set 2 of 3 values - in other words, it is year-only, or full date.

I'm not sure I understand where you are entering the values from your example.  If I enter 0/0/2000 in the Date field, MC rejects the value.

Can you elaborate?
Logged
The opinions I express represent my own folly.

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: Date expression
« Reply #2 on: March 28, 2013, 07:00:16 pm »

If there is no day or month info, MC will when displaying the Date field show 1 (or 01) for the missing value(s). There is no workaround that I know of, and there is no way that I know of to distinguish an empty day or month value from 1 as the actual value for day or month. Remember this when evaluating statistics shown by MC (the first of the month is probably not the most popular day to release an album although you might think it is judging from the MC statistics).
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Date expression
« Reply #3 on: March 28, 2013, 07:06:05 pm »

I did a expression date FormatDate([Date, 0], MMM dd), [year] but when i dont have tag on day and month it show me the first day and the first month of the year, that i want to remove, and to show me only the year if the rest is empty.
Here you can see a small image of what i mean.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Expression help
« Reply #4 on: March 28, 2013, 07:46:16 pm »

Day column:
   ifelse(compare(length([date]), >, 4), formatdate([date,0], dd))

Month column:
   ifelse(compare(length([date]), >, 4), formatdate([date,0], MMM))
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Expression help
« Reply #5 on: March 29, 2013, 10:35:25 am »

Thank you for the quick reply, is what i looking for, now i need to figure how to put it on use and to work with my field, some tweak need to be complete, and if you don't mind i have a few favor if you want to help me, because i see you kinda play with expression rather than me, (kinda weak in this part).
What i want is this, i have a view where i have item playing and i set this items to be separate in group (i use isplaying field) and then i group by what is play. The problem is that at the group text it appears 1 and 0, that mean the 1 is actual what is played and the zero is on hold, what i want?, well instead of 0 and 1 i want to see 1=play, 0=next to play. Is possible?
And second asking for now :P is, at field list if you have more than one item the next item is not separate by /, but instead ; anyway to make let say each item to be separate by / ?
I will show you the example
And thank you again :)
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Expression help
« Reply #6 on: March 29, 2013, 02:17:36 pm »

if(isplaying(),Play, Next to Play)

Replace([artist,0],/ //, ;)
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Expression help
« Reply #7 on: March 29, 2013, 04:14:38 pm »

YOU are my man :) Thank you very much.
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Expression help
« Reply #8 on: March 30, 2013, 01:04:18 pm »

It seems that second expression doesn't work well or im not doing something good
I have this expression [guest artist] is a data/edit type list
I want to associate with the artist and show me, [artist] / [guest artist] (where the last field have multiple items inside)
Example: Tim McGraw / Taylor Swift / Keith Urban, instead for me it show something like this Tim McGraw / Taylor Swift; Keith Urban.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Expression help
« Reply #9 on: March 30, 2013, 01:19:20 pm »

If you want to combine two list fields, you can use ListCombine():

If your Artist fields are separated by a / character, then MC by default doesn't consider each item as a list item - it is just one big string.  So you can recombine the list in various ways, replacing the separator characters as desired:

replace(listcombine([artist],[guest artist]), ;, / //)
ListCombine(listcombine([artist],,//,;),[guest artist], ;, / /// )
ListCombine(replace([artist], / //, ;), [guest artist], ;, / /// )


There are plenty of ways - the key is to consider what the combined fields look like, and then replace characters where you need to.
Logged
The opinions I express represent my own folly.

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Expression help
« Reply #10 on: March 30, 2013, 01:22:32 pm »

In your example, I can't tell which values belong to which field.  Perhaps some longer examples are better:

Artist:
   Tim McGraw / Taylor Swift

Guest Artist:
   Keith Urban; Sam Spade

It might be easier if you change all your Artists to use ; as the delimiter - this way, MC treats them as individual artists. Or at least be consistent throughout.
Logged
The opinions I express represent my own folly.

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Expression help
« Reply #11 on: March 30, 2013, 01:44:05 pm »

In your example, I can't tell which values belong to which field.  Perhaps some longer examples are better:

Artist:
   Tim McGraw / Taylor Swift

Guest Artist:
   Keith Urban; Sam Spade

It might be easier if you change all your Artists to use ; as the delimiter - this way, MC treats them as individual artists. Or at least be consistent throughout.
Artist in this query is Tim McGraw, and the featuring artist is Keith Urban, Taylor Swift so first come artist and second the feature person, but anyway the last two expression work as intended so thank you very much.
But how do you know so much about expression and play with them like a child with toys :)
Any secret?!
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up