Switch statements

234 views
Skip to first unread message

Daniel Smith

unread,
Sep 7, 2016, 7:55:19 PM9/7/16
to XMPie Interest Group
I'm looking to make a composite ador object that combines phone prefix, phone, extension, mobile prefix, mobile, fax prefix, fax, email. I already have all of those set up and am getting the values I want out of them, however I want a composite one so it will automatically adjust positioning based on what information is given (can't use blank line suppression in this case as there is an image at the start of the line meaning the line will never be a null so a blank space if there is no phone number, the image is in the text box because they need to move with the text)

The ideal way to do this would be a switch statement to avoid the countless if statements, however I cannot seem to use the "IsNullOrEmpty()" function or put any real logic into the case literal including using the "Not" or "!" qualifiers as I would like to.

Have I completely missed something in the Qlingo switch statement or is the logic I am looking to put not compatible with the switch statement?

ROBERT

unread,
Sep 8, 2016, 12:10:22 AM9/8/16
to xmpie...@googlegroups.com
Hi Daniel,

I am going to say that you can't use the switch statement that way, it's just looking for the values you assign to the switch to appear in the data and then give you the result.

I have put if/else statements in the switch statement if that helps,

I am not sure I see a way around a lot of if/else statements. Perhaps look at nested adors inside of some InDesign Tagged Text? Maybe if you had a screen grab of your output I would better understand what you are trying to do.


From: "Daniel Smith" <danielj...@gmail.com>
To: "XMPie Interest Group" <xmpie...@googlegroups.com>
Sent: Wednesday, September 7, 2016 6:27:21 PM
Subject: [xmpie-users] Switch statements


I'm looking to make a composite ador object that combines phone prefix, phone, extension, mobile prefix, mobile, fax prefix, fax, email. I already have all of those set up and am getting the values I want out of them, however I want a composite one so it will automatically adjust positioning based on what information is given (can't use blank line suppression in this case as there is an image at the start of the line meaning the line will never be a null so a blank space if there is no phone number, the image is in the text box because they need to move with the text)

The ideal way to do this would be a switch statement to avoid the countless if statements, however I cannot seem to use the "IsNullOrEmpty()" function or put any real logic into the case literal including using the "Not" or "!" qualifiers as I would like to.

Have I completely missed something in the Qlingo switch statement or is the logic I am looking to put not compatible with the switch statement?

--
You received this message because you are subscribed to the Google Groups "XMPie Interest Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xmpie-users...@googlegroups.com.
To post to this group, send email to xmpie...@googlegroups.com.
Visit this group at https://groups.google.com/group/xmpie-users.
For more options, visit https://groups.google.com/d/optout.

Daniel Smith

unread,
Sep 8, 2016, 5:50:34 PM9/8/16
to XMPie Interest Group
Hi Bob, 

Thanks for your reply. after some more digging it does seem that you cant put the logic I am looking for into a qlingo switch in that way which means the only way I can see is 16 else if statements covering every combination of the fields. 

Coming from a java/C++ background I envisioned the switch working the same was as they do there where you can do that sort of logic in it. Back to the drawing board I guess!

Mark Kuehn

unread,
Sep 8, 2016, 9:46:48 PM9/8/16
to xmpie...@googlegroups.com

If you have uPlan you could create a JavaScript or VBscript to do it.

 

-Mark

 

From: <xmpie...@googlegroups.com> on behalf of Daniel Smith <danielj...@gmail.com>


Reply-To: <xmpie...@googlegroups.com>
Date: Thursday, September 8, 2016 at 4:50 PM
To: XMPie Interest Group <xmpie...@googlegroups.com>

--

ROBERT

unread,
Sep 9, 2016, 10:43:35 AM9/9/16
to xmpie...@googlegroups.com

You can also create functions with Javascript so maybe that's an avenue for you to explore, I know more established developers have trouble coping with QLingo limitations and functions are a way around that.

My solution is to always get the data processed properly upstream as much as possible, that way have a minimum of formatting and processing in uPlan.




From: "Daniel Smith" <danielj...@gmail.com>

To: "XMPie Interest Group" <xmpie...@googlegroups.com>
Sent: Thursday, September 8, 2016 4:50:33 PM

Subject: [xmpie-users] Re: Switch statements

--
Reply all
Reply to author
Forward
0 new messages