Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1] 2 3 ... 10
 1 
 on: September 21, 2020, 04:11:12 pm 
Started by Paul M. - Last post by Paul M.
Hi Alex,

Thanks for the lesson on PXML, I didnt know any of that . There should be a tutorial section on the web site with this kind of information explained( or have I not looked hard enough :-) )

I guess I am using the json to keep things simple when I read the data back in from the scanned image. It might be easier to send it out as a delimited string.

I get what you are saying by using aCounter as I can increment every time I do an output to report and use that to order the scanned pages. I am printing the record pr_header  just once in the FIRST PAGE HEADER section and also creating the QR code in the same section in the design then using x and y to position at the top of each page. I didnt think I could access any variables outside the first page header section.



Thanks.

 2 
 on: September 21, 2020, 03:23:56 pm 
Started by Paul M. - Last post by Alex G.
Hi Paul,

the parse error is caused by the double quotes in the JSON value (not the curly braces).

The parsing works as follows: A PXML-RTL expression is evaluated firstly by the RTL evaluator by searching the PXML-RTL expression for substrings of the pattern {expr} and replacing these by their evaluation result. The result of this substitution is then evaluated in a second pass by the PXML evaluator.
Examples:

Example 1 (a numeric property):
PXML-RTL-expression: 1+{2+3}*4+{5*6}+9
Expression after RTL evaluation: 1+5*4+30+9
Expression after PXML evaluation: 60

Example 2 (a string property, the variable aVariable is set to "foo"):
PXML-RTL-expression: "{aVariable}"+" "+format(4,ARABIC)
Expression after RTL evaluation: "foo"+" "+format(4,ARABIC)
Expression after PXML evaluation: "foo 4"

Example 3 (a string property, the variable aVariable is set to ""foo""):
PXML-RTL-expression: "{aVariable}"+" "+format(4,ARABIC)
Expression after RTL evaluation: ""foo""+" "+format(4,ARABIC)
Expression after PXML evaluation: ERROR because ""f is not a valid start of a PXML-expression

Example 4 (a string property, the variable aVariable is set to "\042foo\042" (\042 is the octal escape for a double quote)):
PXML-RTL-expression: "{aVariable}"+" "+format(4,ARABIC)
Expression after RTL evaluation: "\042foo\042"+" "+format(4,ARABIC)
Expression after PXML evaluation: ""foo" 4"

Example 5 (a string property, the variable aVariable is set to ""foo""):
PXML-RTL-expression: "{aVariable.replaceAll(34.toChar(),"\\042")}"+" "+format(4,ARABIC)
Expression after RTL evaluation: "\042foo\042"+" "+format(4,ARABIC)
Expression after PXML evaluation: ""foo" 4"

So the fix for your problem is to replace any double quotes in the variable by an octal escape.
This you can do by using the RTL replaceAll() method so that your expression would look as follows: "{pr_header.qr_code.replaceAll(34.toChar),"\\042")}"+format(getTotalNumberOfPhysicalPages(),ARABIC)

Your worries regarding the usage of a PXML total page number function like getTotalNumberOfPhysicalPages() are unfounded.
Issues like the need to delay printing until the total number of pages is known, is taken care of. Likewise the bar code images are updated in the preview window as soon as the total number of pages is known.

I am asking myself however if doing it this way isn't overcomplicating things a little.
The mechanism, for what we call the "Page n of m" problem in conjunction with bar codes, is designed to drive an enveloping machine so handle a batch print of documents with variable page length.

If I understand you correctly, then you are not actually interested in actual page numbers but you "just" need a number to bring images into an order.
If this is the case, why don't you simply define a variable in the report that is incremented with each print of the variable pr_header.qr_code like this:

LET aCounter=aCounter+1
PRINT pr_header.*, aCounter
 
.. and then use the literal code value property with this expression like this: codeValue="{{pr_header.qr_code+";"+aCounter}}"

Then things are straightforward you also don't need to quote the JSON.
 

 3 
 on: September 21, 2020, 12:25:53 pm 
Started by Paul M. - Last post by Paul M.
Hi Alex,

Thanks for taking the time to look at this.

I have tried the codeValueExpression and get the error attached.

What we want to do is the following:

- User prints delivery dockets
- Dockets given to delivery driver
- On delivery customer signs docket
- Driver returns docket to office
- Office scans the signed dockets
- Associate scanned images to transactions on database for future viewing.

I would like to put a small json string in a qr code that a small python script can then read from the scanned image  giving enough information to associate to a specific transaction in the database.

We have got this to work but we would also like to include the page number in the qr code so that the scanned images could be shown in the correct order. In an ideal world we would also love to include the total number of pages per delivery docket so that the system knows that there are no missing pages but I guess that may not be possible as that is only known at the end of the print.

Text being encoded :  {"doc_type":"BTL","depot_code":"E01","trans_no":494}

Is the {} in the json string causing the error?





 4 
 on: September 21, 2020, 11:41:05 am 
Started by Huy H. - Last post by Sisavanh S.
Hi,

Indeed there is an issue, you should be able to use WSContext to retrieve the headers.
I've filed bug:
GWS-973: WSContext does not retrieve all the headers

Thanks for reporting.
Best regards,
Sisa.

 5 
 on: September 21, 2020, 09:53:45 am 
Started by Paul M. - Last post by Alex G.
Sorry, my first answer was too quick.
I just rechecked and this expression worked just fine: codeValueExpression="{orderline.orders.billfirstname.trim()}"+format(getPhysicalPageNumber(),ARABIC)
In an OrderReport report it yields a code that scans as "Fred1" on the first page.
So contrary to what I said before, you can have an expression that contains both 4GL variables and PXML page number functions.
I am curious to know what this is used for. Would you be willing to explain the business need and give an example of the type of text that is encoded?

Regards,

Alex

 6 
 on: September 21, 2020, 09:24:12 am 
Started by Paul M. - Last post by Alex G.
Hi,

I just verified (please correct me if I misunderstood the question). You can either specify an RTL expression for the "Code Value" property that uses any 4GL variable and RTL function or specify a PXML expression for the "Code Value Expression" property that uses any combination of literal values, the concatenation operator '+' and PXML functions like format() and getPhysicalPageNumber().
In other words, you can write codeValue="This is page 5 of the report "+orderline.orders.report_name" and codeValueExpression="This is page "+format(getPhysicalPageNumber(),ARABIC)+" of the report 'SalesReport'" but you cannot write codeValueExpression="This is page "+format(getPhysicalPageNumber(),ARABIC)+" of the report '{orderline.orders.report_name}'".
There is no technical reason why that shouldn't be possible so that it could be allowed in a future version but the current implementation doesn't support it.

Best regards,

Alex

 7 
 on: September 21, 2020, 03:19:57 am 
Started by Reuben B. - Last post by Reuben B.
The default rendering of the Table object in Genero Report Writer has a border around every cell.  If you remove that border (rule), how can you still have a horizontal line between the Header and the Body.

Read how at https://4js.com/ask-reuben/ig-47/

 8 
 on: September 18, 2020, 09:34:39 pm 
Started by Huy H. - Last post by Huy H.
We are designing a REST web service server application.  So far so good following the WS* field attributes.  We've been using a combination of WSPath, WSParam, and WSHeader go the the parameters we need.

What we find at the moment is that our web service "handler" function parameters is getting quite verbose and repetitive, some would even say messy.

PUBLIC FUNCTION file_attach_post (
  request      T_FILE_ATTACH_REQUEST,
  client_id    STRING ATTRIBUTE(WSHeader, WSOptional, WSName = "X-VTM-client-id"),
  client_token STRING ATTRIBUTE(WSHeader, WSOptional, WSName = "X-VTM-client-token"),
  machine_id STRING ATTRIBUTE(WSHeader, WSOptional, WSName = "X-VTM-machine-id"),
  user_id STRING ATTRIBUTE(WSHeader, WSOptional, WSName = "X-VTM-user-id")
)

For us, most of the WSHeader fields are for auditing purposes, they are not actual parameters for the web service call.  And for every web service we define, we need to add the same header information.  This is unnecessary repetitive, and at the same time, when the "client" code is generated from the openapi.json, these fields become parameters on the other side as well.  Overall, not the cleanest way.

We look further at this and we see that the documentation describes another way of getting the HTTPHeader information using WSContext:
                               
https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_gws_restful_high_level_handling_http_headers.html

I would like to remove those WSHeader variables from our function and access them through a different way.  However, we find that the context DICTIONARY only provide access to a limited  set of keys (Media, BaseURL, Scope, and Content-Type) -- far from what we were looking for.  We do not see our X-VTM-* variables, what are we missing here?

We also tried using com.WebServiceEngine.GetHTTPServiceRequest() function to get the HTTPServiceRequest, but that seems to be only used for low-level REST service.

So question: Is there a way I can access arbitrary HTTP headers in a high-level REST framework design that I'm not aware of?

 9 
 on: September 18, 2020, 04:25:56 pm 
Started by Paul M. - Last post by Paul M.
Hi,

Has anyone used QR codes on a report?
I am looking to put some data from a 4gl variable in the QR code and the page number.

I can put the 4gl data in using Code Value property and the page number using Code Value Expression property(overrides the codeValue property) but only the page number appears.
Is it possible to combine both?

Using fglrun 3.20.10 rev-1ee2d468

Thanks.

 10 
 on: September 17, 2020, 06:24:58 pm 
Started by Dan H. - Last post by Sisavanh S.
Hi,

Are you looking for this page ?
https://4js.com/online_documentation/fjs-gas-manual-html/#gas-topics/c_gas_mult_disp.html

Best regards,
Sisa.

Pages: [1] 2 3 ... 10
Powered by SMF 1.1.21 | SMF © 2015, Simple Machines