How to parse a String?

I’m afraid you’re confusing me. Will you only be using double bars? And is this your own creation? I thought you were parsing data over which you had no control.

Hi Kem!

  1. Yes this is my creation
  2. I Only will use Double bars
  3. I have a database with this Field “Concept”

Each Concept has this: Concept = Quantity: 1||Measurement: PIEZA||Description: FH-8M FLEXOMETRO||UnitPrice: 128.21||TotalPrice: 128.21||Quantity: 7||Measurement: ROLLO||Description: MALLA SOLDADA 66-66 2.5M X 40M||UnitPrice: 2160.00||TotalPrice: 15120.00||Quantity: 200||Measurement: Pounds||Description: First Clase Elizondo Flour||UnitPrice: 3000.00||TotalPrice: 300000.00

Well, Obviously each Row has its own Concept or Concepts.

For this Reason is that I wanna parse this “Concept” field, in order to extract each value: Concept, Quantity, Description,UnitPrice, TotalPrice.

For use it later to print an Invoice.

[quote=200352:@Gerardo García]
3) I have a database with this Field “Concept”[/quote]
Put your data into a separate table (line items), with fields for InvoiceKey, QTY, Measurement, description, and unit price. You could add a column for total price, but unless there’s a reason it would need to be changed, I’d make that calculation either in the SQL or in your program.

And the Common Field between “Received_Invoices” and “Items” Tables must be the column UUID that is the Serial Number of the invoice, right?

Mark’s suggestion is the right way to do it. Here is the updated pattern anyway, but I strongly urge you to follow Mark’s advice.

rx.SearchPattern = "(?U)Quantity: (.+)\\|\\|Measurement: (.+)\\|\\|Description: (.+)\\|\\|UnitPrice: (.+)\\|\\|TotalPrice: (.+)(?=\\|\\|Quantity:|$)"

Whetever you use for your unique primary key in the ‘Received_Invoices’ table, you would put into your foreign key (e.g. InvoiceKey) in the line items table.

You would then use a JOIN to retrieve the related records from the line items table. Or, depending on how you have designed your program, you could do a separate search for the line items using the invoice key (i.e. if you have a list of invoices, and click on a row to view an invoice detail, and you only need to retrieve the line item records)

Thanks man, I’ll Gonna do it! :smiley:

[quote=200360:@Kem Tekinay]Mark’s suggestion is the right way to do it. Here is the updated pattern anyway, but I strongly urge you to follow Mark’s advice.

rx.SearchPattern = "(?U)Quantity: (.+)\\|\\|Measurement: (.+)\\|\\|Description: (.+)\\|\\|UnitPrice: (.+)\\|\\|TotalPrice: (.+)(?=\\|\\|Quantity:|$)" [/quote]
Thanks Kem, You were right, definitely Its a better option to create a table just for “Concepts”, its more practical and organized