Hi,
i’m currently trying some java scripting in seatable. I’m having a table, where i import csv datasets from my banking app. I’d like to have some research possibility on rows, where i made an Amazon purchase. I noticed, that you can search for Amazon-Ids (like 345-1234567-1234567) in the amazon store.
I’d like to get the amazon order-id from a column and optionally generate a link, that i can easily click.
I wrote a java script script, that should do the lookup. I wanted to get the amazon order id with regex. But somehow the regex does not match. I tested it with two different regex-tester. Here is the script.
const amazonBaseUrl = "https://www.amazon.de/gp/your-account/order-details/ref=ppx_yo_dt_b_order_details_o00?ie=UTF8&orderID=";
const subject = base.context.currentRow["Verwendungszweck"].toString();
alert(subject);
if(subject.match('/\d{3}-\d{7}-\d{7}/i')){
const amazonOrderId = subject.match("/\d{3}-\d{7}-\d{7}/");
alert("I found the following order id: " + amazonOrderId);
const url = amazonBaseUrl + amazonOrderId;
}
else {
alert("Couldn't find an Amazon order id");
}
Any idea what could be wrong?