How do I update database offline with a csv file without deleting the information of my previous database and adding the new information below the old information fields of my database ?
Вы хотите обновить уже имеющиеся данные?
В таком случае у каждой строки должен быть свой id, хочу сразу сказать, что pma_id не подходит. так как является временным… Вам нужен постоянный идентификатор строки. в противном случае программа просто не поймет, что менять.
Do you want to update existing data?
In this case, each row should have its own id, I want to say right away that pma_id is not suitable. since it is temporary… You need a permanent row identifier. otherwise the program simply will not understand what to change.
Thank you sir
True words
But even if you use another ID, how will you keep the previous data without deleting it, especially if you updated it from a csv file? Can you apply this to both cases, and even a duplicate PMA ID is not a problem? Note that my database is offline ؟
-
Do you need to add new rows or change existing ones?
-
Is it enough to do it in the editor or is this feature needed in the user application?
Thank you for your reply sir:
1- I want to keep the old rows in my base while adding the new fields when I update to my base from the csv file, and they will be arranged under the old fields of my base, knowing that the csv file only contains new fields.
2- The most important thing is that it is in the user application, and there is no problem if it is in the user and editor application
а вот с добавление новых полей, то тут получиться только в том случае если Вы точно знаете что таких полей в БД нет… Тогда можно так же перебором просто создавать новые поля.
but with adding new fields, then this will only work if you know for sure that there are no such fields in the database. Then you can also simply create new fields by enumeration.
Thank you for your efforts : mr.Vladimir_PV
Based on this explanation and the amazing solution, I will try it
But a question:
1- When the solution is applied, will the last field of the previous information in the rule be known, and accordingly, the new fields will be added immediately after it when updating the csv file?
2-If the field information is similar, will it be added and how is the solution??
в данном примере перебираются все поля и если найдены одинаковые id поля то поле обновляется. так же вы можете добавить правило, что если поле с таким id не найдено, то создать новое поле.
Так же вы можете создать проверку сразу нескольких полей, и уже от этого решать создавать новое поле или нет.
in this example all fields are compared by their id and if the same field ids are found, the field is updated. You can also add a rule that if a field with such an id is not found, a new field is created. You can also create a check for several fields at once, and based on this decide whether to create a new field or not.
Thank you very much
Can you explain this, especially adding new fields under the previous ones, no matter what, all at once? Explain with a video and flp file, please.
Unfortunately,
I tried the solution and it didn’t work. When updating, the similar id in the previous fields is replaced, and the new field is not added after the old fields
1- My problem assumes that the old fields exist while adding the new fields from the csv file when updating
If there is a duplicate in the id and making the order for the date column, for example, or something else, there is no problem with a duplicate in the id
???
все правильно, id может быть только один, это уникальная запись и она не может повторяться, это жесткое правило.
Долее Вы можете использовать этот пример для создания своего алгоритма, Вы можете создать более сложные правила, для отслеживания и добавления полей.
everything is correct, there can only be one id, this is a unique record and it cannot be repeated, this is a strict rule.
Further, you can use this example to create your own algorithm, you can create more complex rules for tracking and adding fields.
empty_24.flp (34.4 KB)
Thank you for your effort and logical explanation, mr Vladimir_PV
I tried this, but unfortunately it still replaces the duplicate ID fields and adds them as new, but I have an idea if you can try it and the solution is at your disposal:
We install the pma_id key, which results in the fields, and at the same time the id column becomes a regular column that allows for repetition, and thus the solution is completed.
Can you explain this in a video and apply it, sir? Many thanks to you.
thank you very much mr.vladimir_PV
I will try that and I hope it will be the solution. Thank you for your great effort