Avatar Digital Publishing Solutions

412-921-7747
Fax: 412-921-4664
Email: info@avatardps.com

Upcoming Opportunities

Untitled Document
webinar
webinar

Monthly RSS Newsletter

No Spam - Powered By MailChimp

Avatar Updates

Follow Avatar DPS

Joe’s Tips: Xdata InData User Interface

Sorry, it’s been a bit since my last post.  Been busy!

Anyhow, sometimes it can be useful to solicit input from the user as a prototype is running.  For example, this question recently came in:

How would I go about creating an interface with InData that would allow a user to choose a master page style as the document is being built?

The solution that Xdata and InData offer is to use the «ask» statement to query the user.  The «ask» statement pops up a dialog with whatever text you specify and an imput box.  You use the «put it into myVariable» statement to capture what the user enters.

So, you could do something like:

«ask “Please enter the name of the desired Master Page”¶
«put it into myMasterName¶
«set firstmaster of this page to myMasterName¶

You can also provide a default response in the ask dialog:

«ask “Please enter the name of the desired Master Page” with “A-Master A”¶

One limitation is that you’re limited to 3 lines of text in the ask dialog.  But, you can be fancy with constructing your 3 lines.  You can either let the lines simply wrap, if your question is very long, or, you can do things like:

«put “how many” & return & “lines can” & return & “I do” & return & “I do” into myText¶
«ask myText with “only 3″¶

Or :

«ask  ”how many” & return & “lines can” & return & “I do”  & return & “I do” with “I said, ONLY THREE!!!”¶

Note that both of the above examples should have created 4 lines in the dialog, but the last line was not placed because it wouldn’t fit.

Also note that, since the prototype begins again from the top with every record (unless you are looping through records within the body of your prototype), the Ask dialog will pop up with every record.  You can control this with a conditional:

«if recordnumber(true) = 1¶
    «ask “Which characters indicate a new book?” with “E,I,J”¶
    «put it into newList¶
    «ask “How many digits will be in the Order Number?” with “9″¶
    «put it into OrdrNbrLngth¶
«endif

The above would ask only once, at the beginning of the prototype.  Or, you could set other conditions.  The following, for example, would query only when it was detected that you were now on a different page:

«if paginfo(3) <> myStoredPageInfo¶
     «put  pageinfo(3) into myStoredPageInfo¶
     «ask “Please enter the name of the desired Master Page”¶
     «put it into myMasterName¶
     «set firstmaster of this page to myMasterName¶
«endif¶

So, if you need to user-provided information to make your prototype smarter, don’t be afraid to «ask…».

Tags: , , , , , , , , ,

Leave a Reply