rivet Posted April 11, 2003 Share Posted April 11, 2003 I am creating a cdml solution that requires a random image. I have a list of theatres with related movies. When I list the theatres I want one random movie image to show beside the name. Link to comment Share on other sites More sharing options...
cjaeger Posted April 11, 2003 Share Posted April 11, 2003 give your movie images a serial number starting at 1, step 1 for the key in the main db use an unstored calculation int(RANDOM * count(MOVIEIMG::ID)) Link to comment Share on other sites More sharing options...
rivet Posted April 11, 2003 Author Share Posted April 11, 2003 That works great, but it can result a zero. Can that be avoided? Link to comment Share on other sites More sharing options...
danjacoby Posted April 11, 2003 Share Posted April 11, 2003 How about: (int(Random * (count(MovieImg::ID) - .5)) + .5 Link to comment Share on other sites More sharing options...
rivet Posted April 14, 2003 Author Share Posted April 14, 2003 that does not seem to work. A bracket it missing but I have tried different combinations and zero still appears. Link to comment Share on other sites More sharing options...
Vaughan Posted April 14, 2003 Share Posted April 14, 2003 Whay not use an In-Line Action with the -FindAny tag? Link to comment Share on other sites More sharing options...
danjacoby Posted April 14, 2003 Share Posted April 14, 2003 Wups -- I added an open parenthesis at the beginning. But there may be a problem using the "Int" function. Try this: Round((Random * (count(MovieImg::ID) - .5)) + .5, 0) Link to comment Share on other sites More sharing options...
rivet Posted April 14, 2003 Author Share Posted April 14, 2003 That was it thanks so much. Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 7844 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now