[Bond-users] Papyrus makelabels
Colin Close
itchka at compuserve.com
Thu Dec 8 18:53:50 EST 2011
On Friday 09 Dec 2011 10:24:21 Jasen Betts wrote:
> On Wed, Dec 07, 2011 at 11:13:27PM +0000, Colin Close wrote:
> > Hi,
> > I'm wondering if there is any way to pass the label size/type from
> > papyrus_gui to the makelabels engine. The label types are defined in
> > makelabels.conf. Can it be passed as a parameter in the report xml or is
> > this functionality limited to database items?
> > So far the way I've been using it is to edit the first label in the list
> > which the program appears to default to. Obviously this is a bit
> > limiting!! Best
> > Colin Close
>
> makelabels is a script that runs on the output of the papyrus text
> engine there has never been seamless integration.papyruns isn't geared
> towards users making formatting decisions at run-time.
>
> one way of fixing this would require changes to papyrus GUI. (I guess
> it would need to read makelabels.conf and let the user choose)
>
> in another the papyrus script could possibly be changed to treat certain
> parameters specially. (eg if they start with "__LABELS__") and pass
> them to makelabels instead of to the papyrus backend (which is the bit
> that extracts the data from the database)
>
> a more papyrus-like option might be to work out a method where the template
> could be specified in the papyrus XML and arrange for the papyrus
> script to pull that setting.
Hi Jasen,
Thanks for your reply. The thing is that it so very nearly works.
If I pass 'papyrus -l avery7160 -t labels (xml file)' from the command line
papyrus works, as it already has support for the label type. By using a space
as the name of the variable in papyrus_gui I can pass the '-l avery7160' the
problem arises because papyrus_gui always outputs the -a variable name=value
when a report parameter is used thus my dummy variable ends up being -a =-l
avery7160
The -a option is described in the papyrus help as follows:-
-a | --arg [a=b] Add variable definition a = b
which is almost certainly not going to work for the label option.
What is needed if the ability with papyrus_gui to optionally disable the -a
flag generation to allow user option to be passed to papyrus.
I have looked at the source code for the section that does this work and it
seems to me from my limited understanding of C coding that if the variable
name defined in the requires section of the xml began with a '-' or '--' an
extra 'if' statement in this section of code could then overrride the -a %=%
stuff and simply output the option with its parameter.
I've pasted the code from report.c here so you can see how simple the change
could be. I have put in some pseudo code 'cus alas I have yet to grasp C.
Its not elegant but I think it would work. What do you think?
Best
Colin
if (parameter_list)
{
walk = g_list_first (parameter_list);
while (walk)
{
param = (require_parameter *) walk->data;
pseudo_code
if (param)="-"
elif (param="--"
args=g_list_append(args, mem_strdup_printf ("%s=%s", param->ident,
else;
pseudo_code
if (param->value)
{
args=g_list_append(args,mem_strdup("-a"));
args=g_list_append(args, mem_strdup_printf ("%s=%s", param->ident,
param->value));
}
walk = walk->next;
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.hcoop.net/pipermail/bond-users/attachments/20111208/930036b4/attachment.htm
More information about the Bond-users
mailing list