I have these plain-text reports. Can I please have some suggestions on what general approach to use to get these into crystal reports? Can I parse the file within CR? Do I need to script outside CR and re-write to a different format? I'm new to CR, and if there's a different software that would be better for this I'm open to that. The end-goal is to transform these reports into a nicely formated pdf with company logo, a few graphics, styled table, etc.
You can see the file contains data fields that I would need to capture such as account number, name etc. But then also a variable length table with headers.
Example report: (This is the exact format, with just identifying information changed)
MY REPORT Page: #
10/18/17 09:44 AM
ACCOUNT NUMBER : 456789
COMPANY NAME : JOHN DOE
ADDRESS : 8001 ANYWHERE DR
SOME PLACE, USA
SYSTEM TYPE : MAXMODEL9000
ID EVENT TYPE DESCRIPTION
---------- ---------------------- --------------------------------
3 TYPE 1 BLAH BLAH
4 TYPE 1 BLAH
5 TYPE 1 BLAH BLAH BLAH
6 TYPE 2 DR
7 TYPE 3 KITCHEN
11 TYPE 3 SOMETHING
12 TYPE 4 SOME DESCRIPTION
13 TYPE1 TEST
Related
I need to find all the records which contains the given sub-string(art), and the condition is the given substring is either a complete word within the string or the start of any word within the string.
Sample data. Program
id | name
-----------
10 | Report of Quarter 1
11 | The Art Program
12 | The Artificial Program
From the above data, I must be able to get the record numbers 11 and 12 but not 10.
I am trying like this
Program.where("name ~* ?",'art\b')
but it's not working
I have also tried with
Program.where("regexp_match(name, ?)",'/art\b/i')
this too is not working
any help is really appreciable. Thanks!
EDITED
I guess you are using Postgres since you gave an example with regexp_match
Try Program.where("name ~* ?",'\mart') :)
You can see hidden in the Postgres docs ("Regular Expression Escapes" section) that \b means "backspace, as in C" whereas \m "matches only at the beginning of a word"
I have code that generates the following strings which are messaged to slack.
I have XXXd my token and Channel name. Other than that - these are exact as they are sent to slack.
The code executes about 50 of these - and only SOME of them fail
Item 5 returns the error:invalid_arg_name
https://slack.com/api/chat.postMessage?token=xxx&pretty=0&username=CNS&channel=mychannel&text=List
Updated: 7/26/2020 12:28 PM
https://slack.com/api/chat.postMessage?token=xxx&pretty=0&username=CNS&channel=mychannel&text=
(Pops and Beverages ): |1000| Diet Cola - 2 Liter: Order: 7 to 8 - 2-Liter"
https://slack.com/api/chat.postMessage?token=xxx&pretty=0&username=CNS&channel=mychannel&text=
(Pops and Beverages ): |0999| Diet Cola - Pepsi - Cans: Order: 3
to 4 case
https://slack.com/api/chat.postMessage?token=xxx&pretty=0&username=CNS&channel=mychannel&text=
(Seasoning ): |0997| Spices - Italian: Order: 1 to 1 each
https://slack.com/api/chat.postMessage?token=xxx&pretty=0&username=CNS&channel=mychannel&text=
(Breads & Cereal ): |0974| Bread - White Meijer Split Top:
Order: 1 to 1 each
You should encode your text before sending it to the API. In example 5, you are sending an unencoded ampersand ("Breads & Cereal"), causing the API to interpret everything after the ampersand as a query parameter name (thus the error, "invalid_arg_name").
Try sending it like that:
https://slack.com/api/chat.postMessage?token=xxx&pretty=0&username=CNS&channel=mychannel&text=%20%28Breads%20%26%20Cereal%20%29%3A%20%7C0974%7C%20Bread%20-%20White%20Meijer%20Split%20Top%3A%20Order%3A%201%20to%201%20each.
I recommend you to search for how to do percent encoding or url encoding in the programming language you are using.
I am using ZPL for the first time to generate shipping labels. I am using a ruby-on-rails gem https://github.com/rjocoleman/labelary to ultimately turn the ZPL sting into a pdf. I want to create multiple pages, incrementing a variable for each page using a loop until enough pages have been created. Say the ZPL looks like this:
^XA
^FX Top section with company logo, name and address.
^CF0,60
^FO50,50^GB100,100,100^FS
^FO75,75^FR^GB100,100,100^FS
^FO88,88^GB50,50,50^FS
^FO220,50^FDInternational Shipping, Inc.^FS
^CF0,40
^FO220,100^FD1000 Shipping Lane^FS
^FO220,135^FDShelbyville TN 38102^FS
^FO220,170^FDUnited States (USA)^FS
^FO50,250^GB700,1,3^FS
^FX Second section with recipient address and permit information.
^CFA,30
^FO50,300^FDJohn Doe^FS
^FO50,340^FD100 Main Street^FS
^FO50,380^FDSpringfield TN 39021^FS
^FO50,420^FDUnited States (USA)^FS
^CFA,15
^FO600,300^GB150,150,3^FS
^FO638,340^FDPermit^FS
^FO638,390^FD123456^FS
^FO50,500^GB700,1,3^FS
^FX Third section with barcode.
^BY5,2,270
^FO175,550^BC^FD1234567890^FS
^FX Fourth section (the two boxes on the bottom).
^FO50,900^GB700,250,3^FS
^FO400,900^GB1,250,3^FS
^CF0,40
^FO100,960^FDShipping Ctr. X34B-1^FS
^FO100,1010^FDREF1 F00B47^FS
^FO100,1060^FDREF2 BL4H8^FS
^CF0,190
^FO485,965^FDCA^FS
^XZ
How can I add a page break to the end of the ZPL string, so the loop can create a new identical page after the first one (all in a single zpl string)?
Thanks in advance
If your pages are truly identical, you could just use the ^PQ command to set the number of copies you want to print (e.g. ^PQ3 to print three copies). This command must appear before the ^XZ command.
However if your pages aren't identical (maybe you have a sequence number or something), just start a new format by using a new ^XA command after your first page is done.
I am trying to remove some fonts from the Zebra ZT410 memory which I loaded them during testing. I deleted them using the Zebra Designer Fonts but when I print the command ^XA^WD*:*.TTF*^XZ to show me the fonts stored on the printer it still shows me those fonts that I deleted in the E: directory of the printer. Can somebody please help me to delete them from the printer.
cheers
From the ZPL manual:
^ID – Object Delete
The ^ID command deletes objects, graphics, fonts, and stored formats from storage areas. Objects can be deleted selectively or in groups. This command can be used within a printing format to delete objects before saving new ones, or in a stand-alone format to delete objects.
The image name and extension support the use of the asterisk (*) as a wild card. This allows you to easily delete a selected groups of objects.
Format: ^IDd:o.x
Parameters Details
d = location of stored object
Values: R:, E:, B:, and A:
Default: R:
o = object name
Values: any 1 to 8 character name
Default: if a name is not specified, UNKNOWN is used
x = extension Values: any extension conforming to Zebra conventions
Default: .GRF
Example 1: To delete stored formats from DRAM:
^XA
^IDR:*.ZPL^FS
^XZ
Example 2: To delete formats and images named SAMPLE from DRAM, regardless of the
extension:
^XA
^IDR:SAMPLE.*^FS
^XZ
Example 3: To delete the image SAMPLE1.GRF prior to storing SAMPLE2.GRF:
^XA
^FO25,25^AD,18,10
^FDDelete^FS
^FO25,45^AD,18,10
^FDthen Save^FS
^IDR:SAMPLE1.GRF^FS
^ISR:SAMPLE2.GRF^FS^XZ
Example 4: In this the * is a wild card, indicating that all objects with the .GRF extension are deleted:
^XA
^IDR:*.GRF^FS
^XZ
I use an ODBC table handler to read data from Excel and CSV files into an AMPL model. But the thing I encountered probably doesn't have much to do with the precise programs and programming language I use.
Among the data are two specific types of strings: three-digit alphabetic and six-digit alphanumeric.
When the three-digit alphabetic type includes a NAN string, AMPL throws an error. As I found out, the reason is that it understands NAN as "NaN" (not a number). It cannot use this as an index.
The six-digit alphanumeric type sometimes include strings like 3E1234. This seems to be a problem because AMPL (or the handler) understands this as a number in scientific notation. So it reads 3*10^1234, which is handled as infinity. So when there is one 3E1234 entry and one 3E1235 entry, it sees them both as infinity.
I understand these two. And although they are annoying, I can work with that. Now I encountered that a string SK1234 is parsed as the number 1234. I have learned a bit of programming in college, but I don't have any idea why this happens. Is the prefix SK anything special?
EDIT: Here is an example that reproduces the error:
The model file:
set INDEX;
param value;
The "run" file:
table Table1 IN "tableproxy" "odbc" "DSN=NDE" "Test.csv": INDEX <- [Index], value ~ Value;
read table Table1;
NDE is a user DSN that uses the Microsoft Text Driver in the appropriate folder.
And the CSV file:
Index,Value
SK1202,1
SK1445,2
SK0124,3
SK7896,4
SK1,5
AB1234,6
After running all this code, I type display INDEX and get
set INDEX := 1202 1445 124 7896 1 Missing;
So the field Index is treated as a numeric field with the first five entries converted to a number. The last entry cannot be converted so it is treated as Missing.
The DSN's setting is that it sets the type according to the first 25 lines. For some reason, it understands the SK... entries as numbers and therefore reads all as numbers.
For the Text ODBC driver to detect column type correctly, values should be quoted:
Index,Value
'SK1202',1
'SK1445',2
'SK0124',3
'SK7896',4
'SK1',5
'AB1234',6