J
Jonathan
Hi all,
I have a file consisting fixed width records from which I need to
extract only those lines meeting certain conditions.
These conditions do change and I find myself recoding/compiling for each
set of conditions then running again.
e.g.
scenario 1:
extract lines where field1=100023 and field3 = "PP"
scenario 2:
extract lines where field1 in (1234,2335,12123,213213)
scenario 3:
extract lines where field3 in (PP,OP,TD,WL) and field4 =04 OR (field3 =
PA and field5 = 03)
As you see it can easily be a non-trivial expression that determines
which lines need to be extracted - this is making it very difficult to
code for every eventuality. It's very SQL-esque but it's not possible to
use SQL in this case - the prog reads and processes each line via a stream.
I was thinking about creating an expression builder, allowing the user
to define the expression with any nesting etc and incorporating this
into the code in some dynamic way at runtime.
I cannot seem to work out how i might do this, though.
Anyone have an inkling on how this might best be done?
Grateful for your thoughts
Regards
Jon
I have a file consisting fixed width records from which I need to
extract only those lines meeting certain conditions.
These conditions do change and I find myself recoding/compiling for each
set of conditions then running again.
e.g.
scenario 1:
extract lines where field1=100023 and field3 = "PP"
scenario 2:
extract lines where field1 in (1234,2335,12123,213213)
scenario 3:
extract lines where field3 in (PP,OP,TD,WL) and field4 =04 OR (field3 =
PA and field5 = 03)
As you see it can easily be a non-trivial expression that determines
which lines need to be extracted - this is making it very difficult to
code for every eventuality. It's very SQL-esque but it's not possible to
use SQL in this case - the prog reads and processes each line via a stream.
I was thinking about creating an expression builder, allowing the user
to define the expression with any nesting etc and incorporating this
into the code in some dynamic way at runtime.
I cannot seem to work out how i might do this, though.
Anyone have an inkling on how this might best be done?
Grateful for your thoughts
Regards
Jon