IF NEW.MESSAGE LIKE 'Initiating Order Placement for User:%' THEN SET NEW.leg_id = CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(NEW.MESSAGE, 'Leg ID: ', -1), ';', 1) AS UNSIGNED); SET NEW.symbol = TRIM(SUBSTRING_INDEX(SUBSTRING_INDEX(NEW.MESSAGE, 'Symbol: ', -1), ';', 1)); SET NEW.quantity = CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(NEW.MESSAGE, 'Qty: ', -1), ';', 1) AS UNSIGNED); SET NEW.transaction_type = TRIM(SUBSTRING_INDEX(SUBSTRING_INDEX(NEW.MESSAGE, 'Txn: ', -1), ';', 1)); SET NEW.is_exit = (SUBSTRING_INDEX(SUBSTRING_INDEX(NEW.MESSAGE, 'IsExit: ', -1), ';', 1) = 'True'); SET NEW.exit_sl = (SUBSTRING_INDEX(SUBSTRING_INDEX(NEW.MESSAGE, 'ExitSL: ', -1), ';', 1) = 'True'); SET NEW.order_type = TRIM(SUBSTRING_INDEX(SUBSTRING_INDEX(NEW.MESSAGE, 'OrderType: ', -1), ';', 1)); SET NEW.at_broker = TRIM(SUBSTRING_INDEX(SUBSTRING_INDEX(NEW.MESSAGE, 'AtBroker: ', -1), ';', 1)); END IF