It is necessary to process many many rows of the table, filtering them by columns. Perhaps I'll start immediately with an example.

Example of columns (filters): Имя-Фамилия-Возраст-Зачет(1-зачет,0-не зачет)

Sample data (strings):

 Иван Иванов 20 1 Петр Петров 23 0 Иван Петров 23 1 Петр Иванов 21 0 

PS row is divided into arrays of columns, that is, a separate array of names, surnames of age and result, as well as the corresponding arrays with options.

Иван, Петр, Иван, Петр - column array

Иван, Петр - an array of column options

Now, I need to display the number of credits and non credits for all filter options. Example: Иван 2 0 - with a filter in the name "Иван" 2 зачет и 0 не зачет

Петров 1 1 - with a filter on the name "Петров" 1 зачет и 1 не зачет .

And so you need to display the result for each filter. In this case there will be 12 filter options. Some of them: "Иван" ; "Петр" ; "Иван" and 20 (age); "Петров" and 23 , etc.

So far I have only one idea - to make several nested loops and in the last one shove 12 if , which of course is very dreary, because in fact I have more filters and values, I don’t really want to prescribe 64 if .

UPD I understand that this can be solved through С++ or SQL , but I work in Pascal, and it seems to me that this is not real, I have found similar tasks like Example 1 and Example2 , I still don’t rummage in C, somebody could explain the solution?

UPD2 That's what's in reality. You need to find all kinds of filter combinations and pass to them. For example, the filter is 51% in the first column, the number of проходов (1) = 1. And so I need to find for all combinations, for example - 51% in the first column and 23% ; 25% in the third column and a forecast of 12 and so on. Now I can find all this separately, that is, I can process only 1 variant of the combination. I pound the data of the Проц1 and Проход columns into the program and then compare it with percentages from 1 to 100, and for each from 1 to 100 the number of Проходов 1 and 0 comes out. What's the reality

  • one
    show database structure with more real fields. It's easier - Saidolim
  • @hichock You have data in which format in general: they are in the file, the program asks the user if they are already in a normal database, if so, in which? And what makes you think that it is impossible to write something on pascal, the first versions of Windows on pascal were written ... in what format the filters are set. What is a "filter" in general - is the condition of the format "column N" = X? - Mike
  • painted for more details - hichock
  • As you have "more" and "clearer" completely different things. For example, I finally confused what is required. In my understanding, a “filter” is some values ​​based on which it is necessary to select rows from a certain set. If you just need to sort through all possible conditions, then a bunch of nested loops, each in its own column. If for each separately, then over the fact that you have one cycle that goes through the columns - Mike
  • Yes, you need to go through all the possible options, but if you do a bunch of nested loops, then you have to do 64 “If” - hichock

0