tsteward Well-Known Member Licensed User Longtime User Feb 16, 2022 #1 I have a local database that I want to search. At the moment I have one column named series. I can change this to two columns if need be. EG Min & Max but I don't think its that straight forward. Some have no letters and others have letter only or a mix of both. Below is a sample. When I enter say H2312 I want to return all records where that might be possible. And another for line 16 below 0L213 Any suggestions on how this might be done or the best way to do it? Spoiler: Table SeriesH0001-H3000X8001-X9000S0001-S2000X0001-X8000G0001-G2377P0001-P2390X0001-X2248W0001-W240910001-15000J0001-J12000001X-1706XT0001-T10001-221853001-4481E5001-E77000K001-0N7188001-9554V2001-V320070000-75928J00-U39E0001-E2500G0001-G2500HK0001-HK2500J0001-J2500K0001-K2500KE0001-KE2500L0001-L1037P0001-P2500T0001-T2500V0001-V2500LK0001-LK250040000-49999O0001-O5000D0001-D3000M0001-M2618VN0-VN199950000-69999S4001-S5200S5298-S6300G8001-G9000B8001-B9000B8001-B9000K0001-K100010100-1228320100-23284K0001-K1000N225-N814U1-U2000FA0-FA1863T1-3456T1-26789T5-3456T1-T1200Y2001-Y30007001-9000E2001-E3000E4001-E5000E5000-E5999E6001-E7000E8000-E8999L8001-L10000NSP4000-NSP4999NSP7001-NSP9000G000-G3631S000A-S999K30010-32009C8001-C9000Y7001-Y820030001-3785040001-415186001-7001A6001-A7000D0001-D2000D4001-D52001HM1-99HM991NF1-99NF99HM1-HM1200HM2501-HM3500HM4001-HM7350HM6001-HM7110NF1-NF1200NM2501-NM35005001-8442M0001-M12003001-40006001-7000AB6001-AB6891N6001-N7000V1-V3056V5001-V8058W1-W96401V00001-5V12295L000-L999B1001-B2200 NewB1001-B2200 OldB5001-B6200B5001-B6200HB1-HB2988HB3001-HB5000T1-T2330HV1-HV854HV1001-HV1918HV2001-HV2830
I have a local database that I want to search. At the moment I have one column named series. I can change this to two columns if need be. EG Min & Max but I don't think its that straight forward. Some have no letters and others have letter only or a mix of both. Below is a sample. When I enter say H2312 I want to return all records where that might be possible. And another for line 16 below 0L213 Any suggestions on how this might be done or the best way to do it? Spoiler: Table SeriesH0001-H3000X8001-X9000S0001-S2000X0001-X8000G0001-G2377P0001-P2390X0001-X2248W0001-W240910001-15000J0001-J12000001X-1706XT0001-T10001-221853001-4481E5001-E77000K001-0N7188001-9554V2001-V320070000-75928J00-U39E0001-E2500G0001-G2500HK0001-HK2500J0001-J2500K0001-K2500KE0001-KE2500L0001-L1037P0001-P2500T0001-T2500V0001-V2500LK0001-LK250040000-49999O0001-O5000D0001-D3000M0001-M2618VN0-VN199950000-69999S4001-S5200S5298-S6300G8001-G9000B8001-B9000B8001-B9000K0001-K100010100-1228320100-23284K0001-K1000N225-N814U1-U2000FA0-FA1863T1-3456T1-26789T5-3456T1-T1200Y2001-Y30007001-9000E2001-E3000E4001-E5000E5000-E5999E6001-E7000E8000-E8999L8001-L10000NSP4000-NSP4999NSP7001-NSP9000G000-G3631S000A-S999K30010-32009C8001-C9000Y7001-Y820030001-3785040001-415186001-7001A6001-A7000D0001-D2000D4001-D52001HM1-99HM991NF1-99NF99HM1-HM1200HM2501-HM3500HM4001-HM7350HM6001-HM7110NF1-NF1200NM2501-NM35005001-8442M0001-M12003001-40006001-7000AB6001-AB6891N6001-N7000V1-V3056V5001-V8058W1-W96401V00001-5V12295L000-L999B1001-B2200 NewB1001-B2200 OldB5001-B6200B5001-B6200HB1-HB2988HB3001-HB5000T1-T2330HV1-HV854HV1001-HV1918HV2001-HV2830
M Mahares Expert Licensed User Longtime User Feb 22, 2022 #41 Looks interesting, but why aren't you using the text file the OP posted an read from it rather then adding each item manually. Also, when you are posting miles of code, it is much better if you export the project to avoid copy mistakes Upvote 0
Looks interesting, but why aren't you using the text file the OP posted an read from it rather then adding each item manually. Also, when you are posting miles of code, it is much better if you export the project to avoid copy mistakes
tsteward Well-Known Member Licensed User Longtime User Feb 22, 2022 #42 emexes said: Righto, third time's the charm, and giving it a break over the weekend didn't hurt either: Click to expand... Okay you're officially a Mad Man ( I mean that in the kindest, most endearing way possible) It obviously got under your skin and became a challenge for you. I THANK YOU!!! for all your time and efforts. Total respect Upvote 0
emexes said: Righto, third time's the charm, and giving it a break over the weekend didn't hurt either: Click to expand... Okay you're officially a Mad Man ( I mean that in the kindest, most endearing way possible) It obviously got under your skin and became a challenge for you. I THANK YOU!!! for all your time and efforts. Total respect
E emexes Expert Licensed User Longtime User Feb 22, 2022 #43 here is the reasoning behind me doing things ? my way ? ? Mahares said: Looks interesting, but why aren't you using the text file the OP posted an read from it rather then adding each item manually. Click to expand... 1/ because the text file was an extract from a database (I think) and thus the OP would be replacing the text-file-reading code anyway 2/ I wanted the example to be a single code file that ran without dependencies or file-finding expeditions 3/ changes to some ranges were required, and it was easier to document those in code Also, when you are posting miles of code, it is much better if you export the project to avoid copy mistakes Click to expand... 1/ ^C ^V into a new project shouldn't be introducing copy mistakes ? 2/ it is nice to be able to see example code directly in the forum post, without having to download and extract 3/ the example was done in B4J, whereas the OP's project is apparently B4A Upvote 0
here is the reasoning behind me doing things ? my way ? ? Mahares said: Looks interesting, but why aren't you using the text file the OP posted an read from it rather then adding each item manually. Click to expand... 1/ because the text file was an extract from a database (I think) and thus the OP would be replacing the text-file-reading code anyway 2/ I wanted the example to be a single code file that ran without dependencies or file-finding expeditions 3/ changes to some ranges were required, and it was easier to document those in code Also, when you are posting miles of code, it is much better if you export the project to avoid copy mistakes Click to expand... 1/ ^C ^V into a new project shouldn't be introducing copy mistakes ? 2/ it is nice to be able to see example code directly in the forum post, without having to download and extract 3/ the example was done in B4J, whereas the OP's project is apparently B4A
E emexes Expert Licensed User Longtime User Feb 22, 2022 #44 tsteward said: It obviously got under your skin and became a challenge for you. Click to expand... It did, because parsing those key codes was a puzzle remarkably similar to parsing part numbers, which is something I used to do a lot of. ? If you do add "wtf is this key code" to your application, and you find cases where example code 3.0 falls over or "gets it wrong", let me know. eg, there's already a bit of unused overkill in the default "is this code in this range" sub that might yet be useful Upvote 0
tsteward said: It obviously got under your skin and became a challenge for you. Click to expand... It did, because parsing those key codes was a puzzle remarkably similar to parsing part numbers, which is something I used to do a lot of. ? If you do add "wtf is this key code" to your application, and you find cases where example code 3.0 falls over or "gets it wrong", let me know. eg, there's already a bit of unused overkill in the default "is this code in this range" sub that might yet be useful
Shelby Well-Known Member Licensed User Longtime User Feb 24, 2022 #45 Although I'm only an expert in the field of not understanding, perhaps line 234 should have the word "lower" replaced with the word "upper"? (This is meant to be a joke, but also true.) Upvote 0
Although I'm only an expert in the field of not understanding, perhaps line 234 should have the word "lower" replaced with the word "upper"? (This is meant to be a joke, but also true.)
E emexes Expert Licensed User Longtime User Feb 24, 2022 #46 Shelby said: perhaps line 234 should have the word "lower" replaced with the word "upper"? Click to expand... Well spotted. Fixed. Had me startled for a moment, thinking: hang on, all the test cases worked ok, how could that mistake have slipped through? Upvote 0
Shelby said: perhaps line 234 should have the word "lower" replaced with the word "upper"? Click to expand... Well spotted. Fixed. Had me startled for a moment, thinking: hang on, all the test cases worked ok, how could that mistake have slipped through?