Forum > Beginners
How can I add data from an external file that will be needed for comparison
teochris:
Hello,
I have thousands of records that I need to declare to my program lets say in an array like the following
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- pksa[535,19]:='316'; pksa[535,1]:='5/1/2003'; pksa[535,2]:='7670914'; pksa[535,3]:='1'; pksa[535,4]:='1005535.76'; pksa[535,5]:='6'; pksa[535,6]:='33943.79'; pksa[535,7]:='142'; pksa[535,8]:='761.68'; pksa[535,9]:='1471'; pksa[535,10]:='28.15'; pksa[535,11]:='4002'; pksa[535,12]:='20.98'; pksa[535,13]:='52386'; pksa[535,14]:='1.51'; pksa[535,15]:='44142'; pksa[535,16]:='1.19'; pksa[535,17]:='186533'; pksa[535,18]:='0.66'; pksa[536,19]:='317'; pksa[536,1]:='9/1/2003'; pksa[536,2]:='5124076'; pksa[536,3]:='0'; pksa[536,4]:='jackpot'; pksa[536,5]:='4'; pksa[536,6]:='34011.05'; pksa[536,7]:='24'; pksa[536,8]:='3010.39'; pksa[536,9]:='630'; pksa[536,10]:='51.11'; pksa[536,11]:='1009'; pksa[536,12]:='51.11'; pksa[536,13]:='23614'; pksa[536,14]:='2.24'; pksa[536,15]:='15756'; pksa[536,16]:='2.24'; pksa[536,17]:='81031'; pksa[536,18]:='1.01'; pksa[537,19]:='318'; pksa[537,1]:='12/1/2003'; pksa[537,2]:='6020778'; pksa[537,3]:='1'; pksa[537,4]:='800000'; pksa[537,5]:='7'; pksa[537,6]:='22835.95'; pksa[537,7]:='42'; pksa[537,8]:='2021.26'; pksa[537,9]:='1145'; pksa[537,10]:='41.87'; pksa[537,11]:='1206'; pksa[537,12]:='41.87'; pksa[537,13]:='35304'; pksa[537,14]:='2.06'; pksa[537,15]:='14969'; pksa[537,16]:='2.06'; pksa[537,17]:='73798'; pksa[537,18]:='1.3'; pksa[538,19]:='319'; pksa[538,1]:='16/1/2003'; pksa[538,2]:='4841440'; pksa[538,3]:='0'; pksa[538,4]:='jackpot'; pksa[538,5]:='14'; pksa[538,6]:='9181.44'; pksa[538,7]:='54'; pksa[538,8]:='1264.15'; pksa[538,9]:='1641'; pksa[538,10]:='28.52'; pksa[538,11]:='1134'; pksa[538,12]:='28.52'; pksa[538,13]:='40367'; pksa[538,14]:='1.56'; pksa[538,15]:='13138'; pksa[538,16]:='1.56'; pksa[538,17]:='55423'; pksa[538,18]:='1.4'; pksa[539,19]:='320'; pksa[539,1]:='19/1/2003'; pksa[539,2]:='5730387'; pksa[539,3]:='0'; pksa[539,4]:='jackpot'; pksa[539,5]:='10'; pksa[539,6]:='15214.17'; pksa[539,7]:='31'; pksa[539,8]:='2606.4'; pksa[539,9]:='601'; pksa[539,10]:='51.48'; pksa[539,11]:='1513'; pksa[539,12]:='41.47'; pksa[539,13]:='31240'; pksa[539,14]:='1.89'; pksa[539,15]:='21117'; pksa[539,16]:='1.87'; pksa[539,17]:='102929'; pksa[539,18]:='0.89'; pksa[540,19]:='321'; pksa[540,1]:='23/1/2003'; pksa[540,2]:='5496013'; pksa[540,3]:='0'; pksa[540,4]:='jackpot'; pksa[540,5]:='1'; pksa[540,6]:='145919.14'; pksa[540,7]:='26'; pksa[540,8]:='2980.52'; pksa[540,9]:='475'; pksa[540,10]:='62.48'; pksa[540,11]:='1895'; pksa[540,12]:='31.75'; pksa[540,13]:='22979'; pksa[540,14]:='2.47'; pksa[540,15]:='31250'; pksa[540,16]:='1.21'; pksa[540,17]:='159543'; pksa[540,18]:='0.55'; pksa[541,19]:='322'; pksa[541,1]:='26/1/2003'; pksa[541,2]:='6356192'; pksa[541,3]:='0'; pksa[541,4]:='jackpot'; pksa[541,5]:='3'; pksa[541,6]:='56252.3'; pksa[541,7]:='24'; pksa[541,8]:='3734.26'; pksa[541,9]:='482'; pksa[541,10]:='71.21'; pksa[541,11]:='1137'; pksa[541,12]:='61.21'; pksa[541,13]:='25006'; pksa[541,14]:='2.63'; pksa[541,15]:='17686'; pksa[541,16]:='2.47'; pksa[541,17]:='98738'; pksa[541,18]:='1.03'; pksa[542,19]:='323'; pksa[542,1]:='30/1/2003'; pksa[542,2]:='6744238'; pksa[542,3]:='1'; pksa[542,4]:='1741345.72'; pksa[542,5]:='5'; pksa[542,6]:='35811.9'; pksa[542,7]:='85'; pksa[542,8]:='1118.75'; pksa[542,9]:='945'; pksa[542,10]:='38.53'; pksa[542,11]:='2348'; pksa[542,12]:='31.45'; pksa[542,13]:='35529'; pksa[542,14]:='1.96'; pksa[542,15]:='29767'; pksa[542,16]:='1.56'; pksa[542,17]:='143607'; pksa[542,18]:='0.75'; pksa[543,19]:='324'; pksa[543,1]:='2/2/2003'; pksa[543,2]:='5545377'; pksa[543,3]:='0'; pksa[543,4]:='jackpot'; pksa[543,5]:='0'; pksa[543,6]:='jackpot'; pksa[543,7]:='27'; pksa[543,8]:='2895.91'; pksa[543,9]:='475'; pksa[543,10]:='63.04'; pksa[543,11]:='1238'; pksa[543,12]:='49.04'; pksa[543,13]:='25593'; pksa[543,14]:='2.24'; pksa[543,15]:='20301'; pksa[543,16]:='1.88'; pksa[543,17]:='105070'; pksa[543,18]:='0.84'; pksa[544,19]:='325'; pksa[544,1]:='6/2/2003'; pksa[544,2]:='5316666'; pksa[544,3]:='0'; pksa[544,4]:='jackpot'; pksa[544,5]:='2'; pksa[544,6]:='144193.61'; pksa[544,7]:='119'; pksa[544,8]:='629.95'; pksa[544,9]:='1517'; pksa[544,10]:='18.92'; pksa[544,11]:='3318'; pksa[544,12]:='17.54'; pksa[544,13]:='51901'; pksa[544,14]:='1.07'; pksa[544,15]:='33482'; pksa[544,16]:='1.07'; pksa[544,17]:='117548'; pksa[544,18]:='0.72'; pksa[545,19]:='326'; pksa[545,1]:='9/2/2003'; pksa[545,2]:='5853800'; pksa[545,3]:='0'; pksa[545,4]:='jackpot'; pksa[545,5]:='1'; pksa[545,6]:='155418.38'; pksa[545,7]:='43'; pksa[545,8]:='1919.5'; pksa[545,9]:='1343'; pksa[545,10]:='31.25'; pksa[545,11]:='1719'; pksa[545,12]:='31.25'; pksa[545,13]:='51513'; pksa[545,14]:='1.41'; pksa[545,15]:='19972'; pksa[545,16]:='1.41'; pksa[545,17]:='81875'; pksa[545,18]:='1.14'; pksa[546,19]:='327'; pksa[546,1]:='13/2/2003'; pksa[546,2]:='6076845'; pksa[546,3]:='0'; pksa[546,4]:='jackpot'; pksa[546,5]:='0'; pksa[546,6]:='jackpot'; pksa[546,7]:='32'; pksa[546,8]:='2677.6'; pksa[546,9]:='704'; pksa[546,10]:='46.61'; pksa[546,11]:='1528'; pksa[546,12]:='43.54'; pksa[546,13]:='34067'; pksa[546,14]:='1.87'; pksa[546,15]:='21777'; pksa[546,16]:='1.87'; pksa[546,17]:='90552'; pksa[546,18]:='1.07'; pksa[547,19]:='328'; pksa[547,1]:='16/2/2003'; pksa[547,2]:='7712624'; pksa[547,3]:='0'; pksa[547,4]:='jackpot'; pksa[547,5]:='3'; pksa[547,6]:='122036.8'; pksa[547,7]:='28'; pksa[547,8]:='3883.85'; pksa[547,9]:='739'; pksa[547,10]:='65.13'; pksa[547,11]:='1197'; pksa[547,12]:='65.13'; pksa[547,13]:='37750'; pksa[547,14]:='2.38'; pksa[547,15]:='17986'; pksa[547,16]:='2.38'; pksa[547,17]:='91120'; pksa[547,18]:='1.35'; pksa[548,19]:='329'; pksa[548,1]:='20/2/2003'; pksa[548,2]:='7838206'; pksa[548,3]:='0'; pksa[548,4]:='jackpot'; pksa[548,5]:='2'; pksa[548,6]:='104052.18'; pksa[548,7]:='48'; pksa[548,8]:='2302.47'; pksa[548,9]:='743'; pksa[548,10]:='56.96'; pksa[548,11]:='2282'; pksa[548,12]:='37.61'; pksa[548,13]:='36416'; pksa[548,14]:='2.22'; pksa[548,15]:='30990'; pksa[548,16]:='1.74'; pksa[548,17]:='144055'; pksa[548,18]:='0.87'; pksa[549,19]:='330'; pksa[549,1]:='23/2/2003'; pksa[549,2]:='9508997'; pksa[549,3]:='0'; pksa[549,4]:='jackpot'; pksa[549,5]:='2'; pksa[549,6]:='126231.93'; pksa[549,7]:='37'; pksa[549,8]:='3623.69'; pksa[549,9]:='1438'; pksa[549,10]:='50.67'; pksa[549,11]:='1630'; pksa[549,12]:='50.67'; pksa[549,13]:='55885'; pksa[549,14]:='2.15'; pksa[549,15]:='20270'; pksa[549,16]:='2.15'; pksa[549,17]:='95978'; pksa[549,18]:='1.59'; pksa[550,19]:='331'; pksa[550,1]:='27/2/2003'; pksa[550,2]:='10747730'; pksa[550,3]:='0'; pksa[550,4]:='jackpot'; pksa[550,5]:='5'; pksa[550,6]:='57070.44'; pksa[550,7]:='56'; pksa[550,8]:='2706.12'; pksa[550,9]:='1457'; pksa[550,10]:='43.14'; pksa[550,11]:='2616'; pksa[550,12]:='43.14'; pksa[550,13]:='60688'; pksa[550,14]:='1.94'; pksa[550,15]:='34737'; pksa[550,16]:='1.94'; pksa[550,17]:='173382'; pksa[550,18]:='0.99'; pksa[551,19]:='332'; pksa[551,1]:='2/3/2003'; pksa[551,2]:='14073509'; pksa[551,3]:='1'; pksa[551,4]:='4338623.12'; pksa[551,5]:='27'; pksa[551,6]:='13838.95'; pksa[551,7]:='71'; pksa[551,8]:='2794.87'; pksa[551,9]:='1773'; pksa[551,10]:='53.09'; pksa[551,11]:='2561'; pksa[551,12]:='53.09'; pksa[551,13]:='67513'; pksa[551,14]:='2.4'; pksa[551,15]:='33611'; pksa[551,16]:='2.4'; pksa[551,17]:='170204'; pksa[551,18]:='1.32'; pksa[552,19]:='333'; pksa[552,1]:='6/3/2003'; pksa[552,2]:='5279321'; pksa[552,3]:='0'; pksa[552,4]:='jackpot'; pksa[552,5]:='0'; pksa[552,6]:='jackpot'; pksa[552,7]:='24'; pksa[552,8]:='3101.6'; pksa[552,9]:='556'; pksa[552,10]:='51.27'; pksa[552,11]:='1202'; pksa[552,12]:='48.09'; pksa[552,13]:='28028'; pksa[552,14]:='2.02'; pksa[552,15]:='16894'; pksa[552,16]:='2.02'; pksa[552,17]:='81097'; pksa[552,18]:='1.04'; pksa[553,19]:='334'; pksa[553,1]:='9/3/2003'; pksa[553,2]:='6059595'; pksa[553,3]:='0'; pksa[553,4]:='jackpot'; pksa[553,5]:='4'; pksa[553,6]:='75262.05'; pksa[553,7]:='39'; pksa[553,8]:='2190.77'; pksa[553,9]:='992'; pksa[553,10]:='39.06'; pksa[553,11]:='1544'; pksa[553,12]:='39.06'; pksa[553,13]:='39743'; pksa[553,14]:='1.75'; pksa[553,15]:='19907'; pksa[553,16]:='1.75'; pksa[553,17]:='94374'; pksa[553,18]:='1.03'; pksa[554,19]:='335'; pksa[554,1]:='13/3/2003'; pksa[554,2]:='5344478'; pksa[554,3]:='0'; pksa[554,4]:='jackpot'; pksa[554,5]:='3'; pksa[554,6]:='47298.62'; pksa[554,7]:='20'; pksa[554,8]:='3767.85'; pksa[554,9]:='338'; pksa[554,10]:='85.38'; pksa[554,11]:='820'; pksa[554,12]:='71.36'; pksa[554,13]:='20709'; pksa[554,14]:='2.73'; pksa[554,15]:='12943'; pksa[554,16]:='2.73'; pksa[554,17]:='71219'; pksa[554,18]:='1.2'; pksa[555,19]:='336'; pksa[555,1]:='16/3/2003'; pksa[555,2]:='7061888'; pksa[555,3]:='0'; pksa[555,4]:='jackpot'; pksa[555,5]:='11'; pksa[555,6]:='17044.83'; pksa[555,7]:='65'; pksa[555,8]:='1531.88'; pksa[555,9]:='2018'; pksa[555,10]:='25.54'; pksa[555,11]:='2502'; pksa[555,12]:='25.54'; pksa[555,13]:='68748'; pksa[555,14]:='1.31'; pksa[555,15]:='23850'; pksa[555,16]:='1.31'; pksa[555,17]:='99063'; pksa[555,18]:='1.14'; pksa[556,19]:='337'; pksa[556,1]:='20/3/2003'; pksa[556,2]:='6522232'; pksa[556,3]:='0'; pksa[556,4]:='jackpot'; pksa[556,5]:='5'; pksa[556,6]:='34633.05'; pksa[556,7]:='64'; pksa[556,8]:='1436.92'; pksa[556,9]:='1242'; pksa[556,10]:='28.89'; pksa[556,11]:='2448'; pksa[556,12]:='28.89'; pksa[556,13]:='49493'; pksa[556,14]:='1.49'; pksa[556,15]:='26012'; pksa[556,16]:='1.49'; pksa[556,17]:='108603'; pksa[556,18]:='0.96'; pksa[557,19]:='338'; pksa[557,1]:='23/3/2003'; pksa[557,2]:='7644152'; pksa[557,3]:='1'; pksa[557,4]:='2300000'; pksa[557,5]:='2'; pksa[557,6]:='101476.11'; pksa[557,7]:='30'; pksa[557,8]:='3592.75'; pksa[557,9]:='673'; pksa[557,10]:='61.33'; pksa[557,11]:='1416'; pksa[557,12]:='59.11'; pksa[557,13]:='33306'; pksa[557,14]:='2.55'; pksa[557,15]:='18328'; pksa[557,16]:='2.55'; pksa[557,17]:='93584'; pksa[557,18]:='1.31'; pksa[558,19]:='339'; pksa[558,1]:='27/3/2003'; pksa[558,2]:='4546568'; pksa[558,3]:='0'; pksa[558,4]:='jackpot'; pksa[558,5]:='2'; pksa[558,6]:='60355.69'; pksa[558,7]:='21'; pksa[558,8]:='3052.69'; pksa[558,9]:='595'; pksa[558,10]:='45.88'; pksa[558,11]:='1025'; pksa[558,12]:='45.88'; pksa[558,13]:='30546'; pksa[558,14]:='1.8'; pksa[558,15]:='12823'; pksa[558,16]:='1.8'; pksa[558,17]:='56641'; pksa[558,18]:='1.28'; pksa[559,19]:='340'; pksa[559,1]:='30/3/2003'; pksa[559,2]:='4687542'; pksa[559,3]:='0'; pksa[559,4]:='jackpot'; pksa[559,5]:='0'; pksa[559,6]:='jackpot'; pksa[559,7]:='24'; pksa[559,8]:='2753.93'; pksa[559,9]:='586'; pksa[559,10]:='43.47'; pksa[559,11]:='1177'; pksa[559,12]:='43.47'; pksa[559,13]:='27387'; pksa[559,14]:='1.87'; pksa[559,15]:='15767'; pksa[559,16]:='1.87'; pksa[559,17]:='76219'; pksa[559,18]:='0.98'; pksa[560,19]:='341'; pksa[560,1]:='3/4/2003'; pksa[560,2]:='5513211'; pksa[560,3]:='0'; pksa[560,4]:='jackpot'; pksa[560,5]:='2'; pksa[560,6]:='135414.99'; pksa[560,7]:='23'; pksa[560,8]:='3379.83'; pksa[560,9]:='597'; pksa[560,10]:='49.86'; pksa[560,11]:='1336'; pksa[560,12]:='45.18'; pksa[560,13]:='30151'; pksa[560,14]:='2'; pksa[560,15]:='17196'; pksa[560,16]:='2'; pksa[560,17]:='79708'; pksa[560,18]:='1.11';
So I can use them later on to make comparisons or writeln some of them.
My program works properly but I add the thousands of declarations like the bove lines then it does start at all and it crashes. Is there a way to add similar data in an array form or whatever so I can use them to make comparisons in my program without causing the program to crash?
Maybe I can add them to an external file or database and use them only when needed. Because I have never done a similar external connection to a file or database can someone explain me (and other readers) what exactly I have to do or even better give me an example? I have my data in excel so I guess I can have them available in the needed form for an external file or database.
taazz:
19 columns thousands of lines? that's easy use an external database engine with the ability to search and sort on request, something along the lines of a firebird or sqlite or some other type of database. Keep in mind that most of the databases will need external files except probably the TDBF. After you decide which database you will use you need to find some sort of admin tool for it eg turbobird for firebird or SQLcc for sqlite that will help you create the table, then you either find an other tool to import the data from your excel file to the table directly or write your own in lazarus. You now have the data in your preferred external database and you already have enough experience to open the database and search for the values you want you are ready to combine everything in to your application.
Nothing fast and easy I'm afraid that you can use to do everything in a few minutes, although there are commercial tools that might help with setting up the external database in a fraction of the time there is no free tool that I know of.
So start by picking an external database depending on how you plan to use that application and if it is to be shared to others or not different databases might have different pros personally I use mostly firebird for my in house tools and applications which can easily converted to an embedded solution if I need to give it to some one else.
teochris:
--- Quote from: taazz on January 25, 2016, 10:56:59 am ---19 columns thousands of lines? that's easy use an external database engine with the ability to search and sort on request, something along the lines of a firebird or sqlite or some other type of database. Keep in mind that most of the databases will need external files except probably the TDBF. After you decide which database you will use you need to find some sort of admin tool for it eg turbobird for firebird or SQLcc for sqlite that will help you create the table, then you either find an other tool to import the data from your excel file to the table directly or write your own in lazarus. You now have the data in your preferred external database and you already have enough experience to open the database and search for the values you want you are ready to combine everything in to your application.
Nothing fast and easy I'm afraid that you can use to do everything in a few minutes, although there are commercial tools that might help with setting up the external database in a fraction of the time there is no free tool that I know of.
So start by picking an external database depending on how you plan to use that application and if it is to be shared to others or not different databases might have different pros personally I use mostly firebird for my in house tools and applications which can easily converted to an embedded solution if I need to give it to some one else.
--- End quote ---
Thanks for your answer it sounds nice but I really do not have a clue how I can do so. I have never used databases or external files with my apps. I sent my files zipped to my customers and they use thema s portable apps. I have a web site based on a linux server and if needed I can use a database there so after I code my program it will read from that database (mysql) if it is possible. Maybe you can upload a test project so I can learn from it because I do not know where to start from!
taazz:
--- Quote from: teochris on January 25, 2016, 11:08:18 am ---
--- Quote from: taazz on January 25, 2016, 10:56:59 am ---19 columns thousands of lines? that's easy use an external database engine with the ability to search and sort on request, something along the lines of a firebird or sqlite or some other type of database. Keep in mind that most of the databases will need external files except probably the TDBF. After you decide which database you will use you need to find some sort of admin tool for it eg turbobird for firebird or SQLcc for sqlite that will help you create the table, then you either find an other tool to import the data from your excel file to the table directly or write your own in lazarus. You now have the data in your preferred external database and you already have enough experience to open the database and search for the values you want you are ready to combine everything in to your application.
Nothing fast and easy I'm afraid that you can use to do everything in a few minutes, although there are commercial tools that might help with setting up the external database in a fraction of the time there is no free tool that I know of.
So start by picking an external database depending on how you plan to use that application and if it is to be shared to others or not different databases might have different pros personally I use mostly firebird for my in house tools and applications which can easily converted to an embedded solution if I need to give it to some one else.
--- End quote ---
Thanks for your answer it sounds nice but I really do not have a clue how I can do so. I have never used databases or external files with my apps.
--- End quote ---
OK.
--- Quote from: teochris on January 25, 2016, 11:08:18 am ---I sent my files zipped to my customers and they use thema s portable apps.
--- End quote ---
target operating system?
--- Quote from: teochris on January 25, 2016, 11:08:18 am ---I have a web site based on a linux server and if needed I can use a database there so after I code my program it will read from that database (mysql) if it is possible. Maybe you can upload a test project so I can learn from it because I do not know where to start from!
--- End quote ---
No there is no need to complicate their life and yours. You can build an update procedure based on your site for data or application if you want but there is no need to demand internet connection for your clients in order for the application to work. Lets start from the basics which operating system your customers use? then we can decide how to proceed.
teochris:
--- Quote from: taazz on January 25, 2016, 11:17:39 am ---No there is no need to complicate their life and yours. You can build an update procedure based on your site for data or application if you want but there is no need to demand internet connection for your clients in order for the application to work. Lets start from the basics which operating system your customers use? then we can decide how to proceed.
--- End quote ---
They mainly use windows 7, 8 and 10
Navigation
[0] Message Index
[#] Next page