mddarfus Posted January 21, 2013 Share Posted January 21, 2013 I'm almost sorry to ask this, as I know the answer will be simple... but I can't seem to remember, or find the exact syntax I need in the maunals or forum responses... I'm looking to return a single PDF page based on a field in my database. The 50-page PDF resource has been added into my FusioPro document resources already. I just need the proper syntax to say something like: If (Field("signtype") == "Sale Pending") return Resource("Sign.pdf") page number 1 If (Field("signtype") == "Sold") return Resource("Sign.pdf") page number 2 If (Field("signtype") == "For Sale") return Resource("Sign.pdf") page number 3 etc...etc...etc... I just can't figure out how to pull certain pages from the one 50-page PDF? It's a Monday for sure! Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted January 21, 2013 Share Posted January 21, 2013 (edited) Something like this: var myResource = Resource("Sign.pdf"); switch (Field("signtype")) { case "Sale Pending": myResource.pagenumber = 1; break; case "Sold": myResource.pagenumber = 2; break; case "For Sale": myResource.pagenumber = 3; break; // etc. } return myResource;Or, if you want to be a bit more succinct: var pages = [ "Sale Pending", "Sold", "For Sale", //etc. ]; var myResource = Resource("signtype"); myResource.pagenumber = pages.indexOf(Field("signtype")) + 1; return myResource; Edited January 21, 2013 by Dan Korn expanded pages array to facilitate adding more entries Quote Link to comment Share on other sites More sharing options...
mddarfus Posted January 21, 2013 Author Share Posted January 21, 2013 Thank you Dan... that's just what I was after. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.