ACF Library

ExtractOrderNumbers

Back to List

Description: Extract 5- or 6 digit numbers from a text, copied from a spreadsheet or similar

FileMaker Prototype:

Set Variable [$res; ACF_Run("ExtractOrderNumbers"; string_list)]

Category: UTILITY

Function source:

Function ExtractOrderNumbers (string list)
   string regex = "(\d{5,6})";
   array string result = regex_extract ( regex, list); 
   return implode ( "\r", result); 
end

The ExtractOrderNumbers function uses regex to extract all 5- or 6-digit numbers from a text document. This can include text copied from a spreadsheet or any other text-based format. The function will ignore other text and only return the relevant order numbers.

Use case:

Imagine you receive a report from a production company listing orders that have been processed and shipped. To invoice these orders, you need to find them in your order system. If the report contains a long list of orders embedded within other text, you can use this function to extract the order numbers. Once extracted, you can use FileMaker relationships to link the list to the orders table, allowing you to quickly view the related records. Additional filters such as delivery status, date range, or specific products can help refine your selection and reduce false positives.

Example:

Content of $$TEXT:

12345 lorem ipsum dolores 
234567 ipsum lorem dolores 1234
12 ipsum dolores not an order number

Then call the function:

Set Variable [$OrderList; ACF_Run("ExtractOrderNumbers"; $$TEXT)]

Result:

12345
234567
Back to List