Merge Switch Question

C

Caroline

As the result of a recent ‘upgrade’ to our company database software I need
to reformat a number of the merge documents that information is pulled into.
When a user sets up an appointment it is done via this software, and part of
this includes the duration of the appointment. Formerly, the software created
a CSV file that showed this as a duration in hours and minuets e.g. “2h 45mâ€
but apparently this was causing problems for some customers and if now just
creates a CSV file containing the duration in minute format, regardless of
duration. Since some of our appointments last a number of hours, it’s really
not suitable to put in 165 minutes in a letter.

I’m using date switches in another part of the letters, but I can’t figure
out how to devise a suitable switch to format this number string into a
format where is displays as something like 1h 45mins instead of just the
number of minuets. I’m sure there should be a way round this, but I just
can’t find it.

Any suggestions would be very helpful.
 
P

Peter Jamieson

As long as the field in the CSV is just a number, you could use something
like

{ = mod({ MERGEFIELD duration },60) \#0 }

to give you the minutes and

{ = int({ MERGEFIELD duration }/60) }

to give you the hours.

If the field also specifies the units, e.g.

{ = mod({ MERGEFIELD duration \#0 },60) \#0 }

to give you the minutes and

{ = int({ MERGEFIELD duration \#0 }/60) }

i.e. using a numeric format switch should effectively strip off the "mins"

Peter Jamieson
131mins

then you can probably get away with
 
G

Graham Mayor

There may be a simpler way which doesn't easily come to mind, but if your
mergefield produces 165 then you can use some mathematics to get the
information you require. The following should work:

{ =INT({Mergefield Fieldname}/60) \# "0'h'" }{ = 60 * (({Mergefield
Fieldname}/60) - { =INT({Mergefield Fieldname}/60) }) \# "0'mins'"}


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
C

Caroline

Thank you both so very much.

I think I was just about to go crazy. Thank you again... you really have
saved me so much stress... and as a bonus I now understand switches a heck of
a lot better.

Have a great week.
 
L

Lee Grimm

In a merge field, how do I convert a currency format to a text forma
or, in the alternative a number format to a text forma
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top