I’m trying to extract the text between brackets on a feed into Zapier.
The feed from the api reads “tickets purchased using discount code (x123456) blah blah”
I want the random code that shows in the brackets. So I can send it to another application.
The code varies in length and format.
Resolved I changed the ( to AAAAA and ) to BBBBB then used the strip function to drop AAAAA and prior and BBBB and
Related
I have a .csv list of emails + names.
Each name can have 1-3 emails along with it (which are currently separated by a comma).
I need to convert this into a .csv list where its 1 name and 1 email.
Here is example:
John Smith,johnsmith1#gmail.com,johnsmith2#gmail.com,johnsmith3#gmail.com
Taylor Smith,taylorsmith#gmail.com
Jack Smith,jacksmith1#gmail.com,jacksmith#gmail.com
...(and there are like 10k more rows)
How can I automatically convert this to:
John Smith,johnsmith1#gmail.com
John Smith,johnsmith2#gmail.com
John Smith,johnsmith3#gmail.com
Taylor Smith,taylorsmith#gmail.com
Jack Smith,jacksmith1#gmail.com
Jack Smith,jacksmith#gmail.com
The main problem here attaching the name to separate rows of the emails that were intially with that name.
I appreciate any help - seems like an easy task, but was stuck on this for few days already, Thanks.
If you can use Notepad++ here is a two steps solution:
Replace > Options: Check • Regular expressions, Uncheck [ ] . matches newline
Rearrange line -> Move Name to end of the line
Search for ^([^,#\n]+),(.+)\R? and replace with $2,$1\n
Step 1 > demo at regex101 (explanation on the right side)
Now the Name can be captured inside a lookahead and used as a replacement.
Search for ([^\n,]++)(?=.*,([^\n,#]+$)),(?:(?1)(?:\n|$))? and replace with $2,$1\n
Step 2 > demo at regex101
Each comma seperated substring gets captured by the first group while the second group captures the Name inside a lookahead and is put before the E-Mail and removed from the end.
After both steps the result should look like your desired outcome. Further info: SO Regex FAQ
QUESTION:
How do you write an ifStatement for Word or for PDF to calculate multiple rows per matching result?
USEAGE:
What I am trying to do seems fairly straight forward and was very easy when I was able to use MS Access 15 years ago, but with Access being not a possibility anymore, I am hoping somebody has a reasonable solution.
The WHAT:
I am trying to generate Statements/Invoices from a CSV (or spreadsheet of any format) into a nice report layout. Let's say the columns look like this:
First Name | Last Name | Account | Address | Item | Description | Item Total
Jane | Smith | 123 | 111 Main St | Ice Cream | it's really cold | $100.00
This is super easy and I can do in Word within 10 minutes and make it "pretty".
BUT what if there are multiple Items per invoice?
So maybe the CSV looks like:
First Name | Last Name | Account | Address | Item | Description | Item Total
Jane | Smith | 123 | 111 Main St | Ice Cream | it's really cold | $100.00
Jane | Smith | 123 | 111 Main St | Hot Dogs | all beef, all the time | $200.00
I still want there to only be 1 invoice per person but not sure how to do an if statement in Word that would say "If there are multiple items per person, put them on a new row, then total them all together"
I would be glad to have the CSV go into a PDF fillable form if I could get the multiple rows to work - I just cannot figure that portion out.
Other options: I looked at OpenOffice "Base" but couldn't get a nice form for a very custom Report. I researched briefly on how to do something like this on AWS, but without any luck. I don't think Microsoft has anything like Access anymore
You can use Word's Catalogue/Directory Mailmerge facility for this (the terminology depends on the Word version). To see how to do so with any mailmerge data source supported by Word, check out my Microsoft Word Catalogue/Directory Mailmerge Tutorial at:
http://www.msofficeforums.com/mail-merge/38721-microsoft-word-catalogue-directory-mailmerge-tutorial.html
or:
http://www.gmayor.com/Zips/Catalogue%20Mailmerge.zip
The tutorial covers everything from list creation to the insertion & calculation of values in multi-record tables in letters. Do read the tutorial before trying to use the mailmerge document included with it.
Depending on what you're trying to achieve, the field coding for this can be complex. However, since the tutorial document includes working field codes for all of its examples, most of the hard work has already been done for you - you should be able to do little more than copy/paste the relevant field codes into your own mailmerge main document, substitute/insert your own field names and adjust the formatting to get the results you desire. For some worked examples, see the attachments to the posts at:
http://www.msofficeforums.com/mail-merge/9180-mail-merge-duplicate-names-but-different-dollar.html#post23345
http://www.msofficeforums.com/mail-merge/11436-access-word-creating-list-multiple-records.html#post30327
Another option would be to use a DATABASE field in a normal ‘letter’ mailmerge main document and a macro to drive the process. An outline of this approach can be found at: http://answers.microsoft.com/en-us/office/forum/office_2010-word/many-to-one-email-merge-using-tables/8bce1798-fbe8-41f9-a121-1996c14dca5d
Conversely, if you're using a relational database or, Excel workbook with a separate table with just a single instance of each of the grouping criteria, a DATABASE field in a normal ‘letter’ mailmerge main document could be used without the need for a macro. An outline of this approach can be found at:
https://answers.microsoft.com/en-us/msoffice/forum/msoffice_word-mso_winother-mso_2010/mail-merge-to-a-word-table-on-a-single-page/4edb4654-27e0-47d2-bd5f-8642e46fa103
For a working example, see:
http://www.msofficeforums.com/mail-merge/37844-mail-merge-using-one-excel-file-multiple.html
The problem with the DATABASE field, though, is that it won't provide the totals you're after. Nevertheless, if you're going down the macro route, it wouldn't take too much more code to append a totals row to the resulting table.
Alternatively, you may want to try one of the Many-to-One Mail Merge add-ins, from:
Graham Mayor at http://www.gmayor.com/ManyToOne.htm; or
Doug Robbins at https://onedrive.live.com/?cid=5AEDCB43615E886B&id=5AEDCB43615E886B!566
PS: While I'm cognisant of StackOverflow's preference for the substance of answers to be posted here rather than linked to, the complexity in this case is far too great to deal with that way, besides which, one can't post the actual field codes or a document containing them here.
I'm trying to convert my country's Open Street Map data to a CSV file which I can then load in tableau and map businesses.
I downloaded osmconvert, which seems to be the default tool for this process.
Then I downloaded the Dominican Republic's data from this URL:
http://download.geofabrik.de/central-america/haiti-and-domrep.html
When I run the following command:
osmconvert64.exe data.osm --csv="#id #lon #lat #amenity #name #shop" --csv-headline --csv-separator=, -o=outfile.csv
I get a sheet like this:
Picture of excel sheet with empty columns
I seem to get the ID, Latitude and Longitude data right, but get empty amenity, name, and shop columns.
Am I writing the command wrong? I'd appreciate any help, since I can't seem to find an user-friendly tutorial on using this tool on the internet.
I'm not very familiar with osmconvert but as far as I know it will generate an entry for each element in the input file. Most elements from the input file won't have a amenity, name or shop tag. That's why you get so many empty columns. I guess you have to specify an additional filter to get only elements with an amenity or shop tag, possibly with the help of osmfilter.
Alternatively just use Overpass API and perform a simple query for all elements with an amenity or shop tag. Overpass API is also able to generate CSV output.
I apologize if this question is vague, but I'll try to be as clear as possible. I've been given a task where I'm to take a text file, store its content in SQL Server 2008, and automate the creation of a form letter given certain inputs. I've been able to break it into the following generic structure (pay no attention to the content, it's just generic text, but the situational break-down is similar):
Welcome [User],
[if #purchase = true, add this paragraph]
Thank you for purchasing the [device / subscription / subscription and device]
from this business on [date].
[#purchase = true and #return = true, add this paragraph]
I'm sorry you returned it!
...
Signed,
[Author]
[Author Image]
Assuming I'm already able to bring in all the necessary variables (user, purchase, return, date, device or device and subscription or subscription only), how should I go about storing the letter pieces in SQL? would it be considered fine to have a structure like the following:
+-------+-----------------+----------+--------+
| Order | Text | purchase | return |
+-------+-----------------+----------+--------+
| 1 | (1st paragraph) | TRUE | null |
| 2 | (2nd paragraph) | TRUE | FALSE |
+-------+-----------------+----------+--------+
Where I store the contents of the first paragraph as:
Thank you for purchasing the [device / subscription / subscription and device]
from this business on [date].
And then write a stored procedure to piece it together based on the Boolean columns, and find/Replace the bracketed bits with input variables to output the entire letter as a string? It doesn't seem like it would be able to handle much variability, to be honest. Maybe breaking down the document into paragraph and sentence tables?
My ultimate goal would be to output this to either a report I create or, perhaps more ideally, to a Word document (though this is probably a whole different bit of research). Am I way off base here? Any insight is helpful.
you can use replace in select statment
for example
SELECT replace(replace(Text, 'device', #deviceVaribale), 'subscription', #subscriptionVaribale) FROM Order
My program includes creating hyperlinks for each row in a MySQL table. So I used the C MYSQL API to retrieve the contents of the table:
while ((row = mysql_fetch_row(result)))
{
....//some code to print the data....
}
I can output the data. But we need to create hyperlinks in each of the printed results and it should link to another page where I can use that certain string for other processing:
text1
text2
The problem is: I need to display the string the user clicked in another page. But how would I know what string the user clicked since they are pointing to the same file?
You should include extra information within the links that would allow you to look it up within your table.
For example:
text1
text2
If the text isn't guaranteed to be unique, perhaps include the row ID there instead.
You can read these extra parameters via
Get escaped URL parameter
if you want to process it clientside or via reading the GET parameters in some other way depending on what you are using server-side.
You can use get function there
like..,
text1
text2
and you can get the string in your another page using,
<?php
$string = $_GET['str']
//do your process
?>