INTERACT FORUM

Please login or register.

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

Author Topic: Can't get Save() Load() global variables to work. Please Help  (Read 721 times)

rbmjr

  • World Citizen
  • ***
  • Posts: 107
Can't get Save() Load() global variables to work. Please Help
« on: January 02, 2022, 07:26:19 pm »

I want to run a Smartlist that captures into global variables the quantity of tunes from the 60's, 70's, 80's, 90's, 00's, 10's, and 20's that I want other Smartlists to use to limit the number of tracks via the "Limit Number to" modifier. I prepared one Smartlist with a "Custom" command to create a global variable called "var_np_1960" and assign it a value. Next I prepared a Smartlist to select songs from that decade limiting the number of tracks to "var_np_1960". Thought it would work, however, it is clear I am doing something wrong. Can someone please help?
Logged

EnglishTiger

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 966
Logged
Win NUC - VENOEN 11Th NUC Mini PC Core i7 1165G7,Dual HDMI 2.0+Mini DP,Windows 11 Mini Desktop Computer,Thunderbolt 4.0,1 Lan, USB-C,Wifi,Bluetooth 5.0,32GB RAM Toshiba MQ04ABF100 ‎500Gb 5400 RPM ‎eSATA HD, Gigabyte GP-GSM2NE3512GNTD 1Tb NVMe SSD, Samsung 870 QVO 8 TB SATA 2.5 Inch SSD (MZ-77Q8T0) in Sabrent Ultra Slim USB 3.0 to 2.5-Inch SATA External Aluminium Hard Drive Enclosure (EC-UK30)

Apple 2020 Mac mini M1 Chip (8GB RAM, 512GB SSD)
Sabrent Thunderbolt 3 to Dual NVMe M.2 SSD Tool-Free Enclosure with Sabrent 2TB Rocket NVMe PCIe M.2 2280 High Performance SSD + Crucial P3 Plus 4TB M.2 PCIe

ET Skins & TrackInfo Plugins - https://englishtiger.uk/index.html

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1852
Re: Can't get Save() Load() global variables to work. Please Help
« Reply #2 on: January 03, 2022, 04:26:22 am »

You want the [1]=1 logic in there to force evaluation and trigger the save

eg
Code: [Select]
[=save(1,v_albuminstrumental[albumunique])1]=1
Logged

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1852
Re: Can't get Save() Load() global variables to work. Please Help
« Reply #3 on: January 03, 2022, 04:27:46 am »

Also, if an expression doesn't work directly you sometimes have to put it in a user field and use that instead, so your limit expression may not work as expected with the load() function.  If not stick the load() into a user defined field and then it will work.
Logged

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1852
Re: Can't get Save() Load() global variables to work. Please Help
« Reply #4 on: January 03, 2022, 04:28:56 am »

When building such views it's always helpful to add an expression column to the view in which you display the contents of the variable so you can see whether the logic is working as expected.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2390
Re: Can't get Save() Load() global variables to work. Please Help
« Reply #5 on: January 03, 2022, 05:03:06 am »

Another problem with setting your global variables in a Playlist is that globals are not persistent - when you restart MC, all of them are gone. So you would always need to open that Globals playlist at least once before your other playlists that use them can work.
Logged

rbmjr

  • World Citizen
  • ***
  • Posts: 107
Re: Can't get Save() Load() global variables to work. Please Help
« Reply #6 on: January 03, 2022, 07:40:42 am »

You all are awesome! Thanks so much for the quick replies, unfortunately my wife told me to stop farkeling with this and watch TV with her. This morning I tried your suggestions and I am halfway there; have the save() part working, stuck on the Load() part.

Attached are a couple of screen shots.

When I added the Load(var_np_1960) to the "Limit Number to" and click apply I get nothing. If I remove the modifier I see that the global variable displays the value set by the previous Smartlist. One of your comments suggested that "you sometimes have to put it in a user field and use that instead." Can you please elaborate? Where do I create a user field? and how to I add the Load() command to it?
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2390
Re: Can't get Save() Load() global variables to work. Please Help
« Reply #7 on: January 03, 2022, 08:38:29 am »

I think you can't use expressions on the playlist modifiers, at least on the Limit one it doesn't seem to work with any expression.
Perhaps you can request this as a new feature.
Logged

rbmjr

  • World Citizen
  • ***
  • Posts: 107
Re: Can't get Save() Load() global variables to work. Please Help
« Reply #8 on: January 03, 2022, 12:49:28 pm »

Thanks for the feedback and everyone's help. Submitted a Feature Request to allow Global variables to be used in Smartlist modifiers. Locking this topic
Logged
Pages: [1]   Go Up