View unanswered posts | View active topics It is currently Mon Sep 06, 2010 12:49 pm



Post new topic Reply to topic  [ 8 posts ] 
 Need Help with syntax for SetV command 
Author Message
Reply with quote
Post Need Help with syntax for SetV command
Does any one have the correct syntax for the following? I cannot a sample exactly on point.

I want to set a variable comprising a concatenation of the value of a data element plus hard-coded text.

To complicate things, the hard-coded text includes a single quote!

I have tried several flavors with no luck, e.g.

<<SetV('p1position',p1PositionSingular & "s")>>
<<SetV('p1possessive',p1PositionSingular + "!'s")>>

The variables are for creating the plural and possessive for a litigation party, done with variables to avoid coding a ton of IF() statements throughout the template library.

The user specifies the singular version in the capture dialog,

e.g. user types "Claimant

and depending on the number of repeating elements entered (number of claimants), the SetV statements are used to make these forms

Claimants
Claimants'

or as the case may be (sole claimant)

Claimant
Claimant's

Thanks in advance!


Thu Apr 22, 2010 8:30 pm
Report this post

Joined: Tue Sep 29, 2009 4:27 am
Posts: 64
Reply with quote
Post Re: Need Help with syntax for SetV command
String concatenation is done with the "concat" command (apologies to all those VB and C# developers out there, I know you would have preferred a + or &, but it's "concat" because XpressDox does all the clever stuff by using XSLT and that's how it's done there.)

Your Setv, Josie, would then read:

<<SetV('p1position',concat(p1PositionSingular,"s"))>>

_________________
Peter Tuffin


Fri Apr 23, 2010 10:36 am
Report this post
Profile Send private message
Reply with quote
Post Re: Need Help with syntax for SetV command
Thank you Peter.

Could you please direct me to the correct place to find that in the documentation? I'm thinking that I'll also find the answers to other questions there.


Fri Apr 23, 2010 11:04 am
Report this post
Reply with quote
Post Re: Need Help with syntax for SetV command
Hi Peter,

I'm still having difficulty with the syntax for the possessive form of the variable, where an apostrophe is needed.

The "position" variable is fine now using Concat(), but the system must be seeing the apostrope ('s or s') as part of the syntax for the possessive variable. I tried using the escape character ! before, and that didn't work.

My code

<<CaptureDataElement(p1PositionSingular)>>
<<Help(p1PositionSingular,Party title - singular form, e.g. Claimant, Plaintiff, Petitioner. The system will automatically pluralize it when necessary.)>>
<<SetV('p1num',0)>>
<<ForEach(p1)>>
<<CaptureDataElement(Full_Name)>>
<<SetV('p1num',position())>>
<<End(ForEach)>>

<<If(GetV('p1num') = 1)>>
<<SetV('p1position',p1PositionSingular)>>
<<SetV('p1posssessive',concat(p1PositionSingular,"'s"))>>
<<Else(If)>>
<<SetV('p1position',concat(p1PositionSingular,"s"))>>
<<SetV('p1possessive',concat(p1PositionSingular,"s'"))>>
<<End(If)>>

Results:
Singular <<p1PositionSingular>>
Position <<GetV('p1position')>>
Possessive <<GetV('p1possessive')>>

Of course, the error I get is "Unbalanced quotes in ....."

Thank-you.


Fri Apr 23, 2010 12:25 pm
Report this post

Joined: Tue Sep 29, 2009 4:27 am
Posts: 64
Reply with quote
Post Re: Need Help with syntax for SetV command
The apostrophe is a problem. In the next release, there is a nice way to handle this, but right now, SetV can't be used to insert a literal (hard coded) apostrophe into a variable.

One way around this right now would be, instead of <<GetV('p1Possessive')>>, use

<<GetV('p1PositionSingular')>>'s

Or, you could sneak an apostrophe into a data element, by including it from a text file, for example, and then use

<<IncludeFileData(SomeOrOtherFile.xdtxt) this includes a data element called "apostrophe">><<ExcludeFromUI(apostrophe)>>
<<SetV('p1Possessive',concat('p1PositionSingular',apostrophe,'s'))>>

How would one of those be? (Until version 3 is out)

_________________
Peter Tuffin


Sat Apr 24, 2010 1:47 am
Report this post
Profile Send private message
Reply with quote
Post Re: Need Help with syntax for SetV command
Hi Peter

I'll try sneaking it into a data element for now and look forward to the upgrade. It's a very important concept for the application - required estimated at least 1,000 times (possibly 2,000 times) in my library of approx. 400 templates. That is why I wish to get it into a variable to avoid so much hard coding and so many unnecessary IFs.

My application won't go into production until July, 2010. Will the version 3 upgrade be available by then? If so, I will move forward assuming it will work.


Sat Apr 24, 2010 8:58 am
Report this post
Reply with quote
Post Re: Need Help with syntax for SetV command
Hi Peter

I tried your work-around to "sneak" it into a data default text file, and that works very well. I actuall need three: apostrophe by itself, apostrope + s, and s + apostrope. Now I'm happy!

This is a perfectly acceptable solution for my app because I must set a bunch of defaults with a text file anyway and that applies to all templates in the collection, so its all done with an in included file. When your upgrade happens, I'll just change the included file and the text file

Thank-you!


Sat Apr 24, 2010 9:53 am
Report this post

Joined: Tue Sep 29, 2009 4:27 am
Posts: 64
Reply with quote
Post Re: Need Help with syntax for SetV command
With Version 3, the apostrophe question is resolved, at least with regard to setting a variable to contain an apostrophe.

For example:

<<SetV('Var',concat('Child','!'s'))>><<GetV("Var")>>

will output the string

Child's

to the merged document.

Note that the apostrophe must be escaped (i.e. preceded with !) in order not to be confused with a string delimiter.

_________________
Peter Tuffin


Last bumped by Anonymous on Mon Aug 23, 2010 7:04 am.


Mon Aug 23, 2010 7:04 am
Report this post
Profile Send private message
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You can post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.