Question

It turns out I need to pass in a query to limit results returned from grabbag. I have a lot more songs in an events playlist (grabbag) than I do pictures with songs associated to them.

What would the query syntax to pass to grabBagGetAllForQuery? I basically need to look and see if the particular WNTrack in the grabbag has a back reference. If not then it hasn't been associated to a photo and shouldn't included in the returned result set.

// FFDL SNIPPET
# 
#
# WNPhoto
#
# event: reference back to EVENT object
# owner: reference back to FFUser
# trackTag: reference back to TRACK
# accessGroup: FFUserGroup
# location: reference back to VENUE object
# image: BYTEARRAY
# previewImage: BYTEARRAY
# thumbnailImage: BYTEARRAY
#
CREATE OBJECTTYPE WNPhoto (event REFERENCE /Events, owner REFERENCE /UserProfiles, trackTag REFERENCE /Tracks, accessGroup REFERENCE /FFUserGroup, image BYTEARRAY, previewImage BYTEARRAY, thumbnailImage BYTEARRAY)

#
# WNTrack
# 
# title: "My Way"
# artist: reference to an object in /Artists
# duration: 297
# albumCover: BLOB
# album: "The Main Event - Live"
#

CREATE OBJECTTYPE WNTrack (title STRING, artist REFERENCE /Artists, duration NUMERIC, albumCover BYTEARRAY, album STRING)
Was it helpful?

Solution

So - if I understand correctly, you want to exclude any items from the grabbag that do not have photos associated??

Using: playlistForEvent = ff.grabBagGetAll(evnt.ffUrl, "playlist");

I think what I would do is get the photos as you are currently:

photosForEventsUri = "/ff/resources/Events/" + evnt.guid + "/photos";
photosForEvent     = ff.getArrayFromUri(photosForEventsUri);

Then loop over and create an Array of tracks that are referenced.

for (var i=0;i< photosForEvent.length;i++) {
    var track  = ff.getReferredObject("trackTag", photosForEvent[i]);
    playlistForEvent.push(track);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top