Общие советы :
1) все данные (и виды платежей) — в одной плоской таблице (без каких-либо объединений ячеек) на одном(!) листе. Разделы «по счету», «по счетчику(по факту)» и «контроль» — это просто дополнительные столбцы справа.
2) вверху оставьте 10 строк для формул «итого», они всегда видны, т.к. область с формулами» закреплена»
3) Долг и переплата — это всегда одна строка, переплату можно ставить красным (формат ячейки — Отрицательное красным)
4) Из-за перерасчетов задним числом и смены тарифов — «помесячные итоги» не так полезны для анализа, как «нарастающий с начала года» или вообще «с начала времен». Я бы внес все квитки с начала года, добавил к январскому сумму долга/переплаты.
5) Т.к. квитанция состоит всегда из 5 строк (Эл.Д, Эл.Н, ХВС, Вывоз ТКО, Утилизация ТКО) — то сразу их скопировать на 2 года вперед. Т.к. тариф меняется условного говоря «раз в полгода» и долго действует — сослаться формулами апреля — на март итд. И когда тариф эл. энергии станет не 2,83 а 4 — просто в том месяце перебиваем формулу на значение 4.
6) Нужно освоить функцию =СУММЕСЛИ(). Формула, которая суммирует все Дн. киловатты (по счету, счетчику и разницу) с начала года будет выглядеть так: =СУММЕСЛИ(Вид;’ЭлДень’;ПоСчету)
=СУММЕСЛИ(Вид;’ЭлДень’;ПоСчетчику)
=СУММЕСЛИ(Вид;’ЭлДень’;Отклон)
Чтобы можно было так легко писать и понимать формулы — нужно дать имена столбцам (точнее их диапазонам с 11-й по, скажем, по 71-строку, вперед на 5 лет). Для этой цели часто делают «официальную» шапку таблицы и ниже, через 1 пустую строку — дублируют её же краткой одной строкой «полей», в ней все слова без пробелов «Электроэнергия День кВт.ч» -> «ЭлДень». Понятности это не уменьшит, а вот скорость написания формулы вырастет пятикратно. Имена диапазонов можно тогда не создавать — Calc сам поймет где находится столбец «ЭлДень», с какой ячейки начинается и где заканчивается.
7) Самым левым столбцом делают «Период», вводят дату, скажем 31.01.18, 28.02.18. а в формате ячейки — Январь 18, Февраль 18 итд. После включения автофильтра на строке «полей», отделенной от «шапки» пустой строкой — появятся значки Автофильтра и возможность легко отбирать нужный период или нужный вид платежа в Автофильтре.
Чтобы автосуммировать видимое (прошедшее фильтр) — нужно освоить функцию =ПРОМЕЖУТОЧНЫЕ.ИТОГИ(9;СЧЕТ)
Полученная плоская таблица обладает громадным плюсом, она все-в-одном, логически целостна. Если захочется сделать по ней отчет — изучаем Сводные таблицы и диаграммы и делаем их на 2-м листе. Но даже просто =ПРОМЕЖУТОЧНЫЕ.ИТОГИ() даст вам информацию о среднем, максимальном, минимальном значении чего угодно за любой период, который выбирается Автофильтром.
Я плачу раз в полгода (ненавижу этот процесс и очереди, т.к. УК до сих пор работает только через ГРЦ-кассы, безнал никак, руководы УК по доброй российской традиции в федеральном розыске), — то оплату я ввожу одной строкой «между» квитанций (заплатил 10/03 — 45 тыс. руб.) Формула у меняя сама делит сумму одного платежа (45 тыс. руб.) на 108 отдельных чисел (по видам платежей). Это достигается суммированием накопленного долга с остатками долга и пени, пропорциональным делением. УК делает все точно так же, и когда с ними спорю — нахожу понимание. Разбивать 45 тр. на 6 квитанций х 6 видов платежей х 3 вида (недоимка/пеня/перерасчет) = 108 цифр — считаю пустой тратой времени. Учетные программы в УК и ТСЖ делают точно так же.
I’m struggling to find what I’m doing wrong with my query.
I did not create the database but here is the structure :
3 TABLES :
vehicule : brand, motor, price, name, id
option : id, description, price
vehicule_option : id_vehicule, id_option
I guess that vehicule_option has 2 foreign keys but I can not find the problem with my addings.
Here’s my code which first part works fine :
public boolean create(Vehicule v){
String query = "INSERT INTO vehicule (MARQUE, MOTEUR, PRIX, NOM) VALUES (";
query += v.getMarque().getId() + ", "
+ v.getMoteur().getId() + ", "
+ v.getPrix() + ", '"
+ v.getNom() + "');";
for (Option o : v.getOptions()){
query += "INSERT INTO vehicule_option (id_vehicule, id_option) VALUES ("
+ v.getId() + ", " + o.getId() + ");";
}
try{
Statement state = this.connect.createStatement();
ResultSet rs = state.executeQuery(query);
} catch (SQLException e){
e.printStackTrace();
}
return true;
}
So, what I’m doing here is basically INSERT two values into the right columns.
It gives me the following exception :
java.sql.SQLIntegrityConstraintViolationException: integrity constraint violation: foreign key no parent; SYS_FK_10132 table: VEHICULE_OPTION
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.executeQuery(Unknown Source)
at fr.ocr.sql.DAOVehicule.create(DAOVehicule.java:35)
at fr.ocr.ihm.AddCarDialogBox$1.actionPerformed(AddCarDialogBox.java:151)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: org.hsqldb.HsqlException: integrity constraint violation: foreign key no parent; SYS_FK_10132 table: VEHICULE_OPTION
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.Constraint.getException(Unknown Source)
at org.hsqldb.Constraint.checkInsert(Unknown Source)
at org.hsqldb.StatementDML.performIntegrityChecks(Unknown Source)
at org.hsqldb.StatementDML.insertSingleRow(Unknown Source)
at org.hsqldb.StatementInsert.getResult(Unknown Source)
at org.hsqldb.StatementDMQL.execute(Unknown Source)
at org.hsqldb.Session.executeCompiledStatement(Unknown Source)
at org.hsqldb.Session.executeDirectStatement(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
... 40 more
-
Torieth
- Posts: 10
- Joined: Wed Apr 29, 2015 2:23 pm

[Solved] Error Integrity constraint violation — no parent SY
Hi, I’m new to this forum and to Base and that may be why I’m struggling so much to do anything. I have learned a lot in this forum without having any account. So thank you, guys, for the help already given.
I have a problem. I’m trying to make a form out of a table with a field named «ID_REQUEST» wich is a Primary key, autocomplete BIGINT from another table with all requests so far.
I can’t fill in the ID_REQUEST due to it’s randomness, but, I have two fields that can. They are REQUEST_NUMBER and REQUEST_ENTRY, they, combined, answer for a unique request. Then I have another problem… A single request may have or not multiple products and there is one resgistry for each product, repeating the combination REQUEST_NUMBER and REQUEST_ENTRY.
I tried the following to select a request from a list box:
Data field is set to: ID_REQUEST
The list box content is obtained by a SQL query like this one: SELECT DSITINCT «REQUEST_NUMBER» || ‘/’ || «REQUEST_ENTRY» FROM «TAB_REQUEST»
When I test this form, it gives me an error called
Integrity constraint violation — no parent SYS_FK_115 table: TAB_REQUEST in statement [INSERT INTO «TAB_PRODUCTION» ( «DATE»,»ID_COLAB»,»ID_REQUEST»,»ID_SETOR»,»OBS»,»PRODUCTION») VALUES ( ?,?,?,?,?,?)]
How can I solve this?
Last edited by Torieth on Wed Apr 29, 2015 6:54 pm, edited 1 time in total.
Open Office 4.1.1
Windows XP SP 3
-
Villeroy
- Volunteer
- Posts: 31087
- Joined: Mon Oct 08, 2007 1:35 am
- Location: Germany
Re: Error Integrity constraint violation — no parent SYS_FK_
Post
by Villeroy » Wed Apr 29, 2015 3:58 pm
Your struggling has nothing to do with Base.
Your database table has a foreign key or two which means that you can not put any value into this field unless it has an equivalent value in the primary key of the referenced table.
I guess that you are going to insert a concatenated value
«REQUEST_NUMBER» || ‘/’ || «REQUEST_ENTRY» FROM «TAB_REQUEST»
into your foreign key where just a valid request_number is possible since the request number existst in the TAB_REQUEST but not the concatenated string.
And like so many others you think that a combo box is helpful but a combo box is just a simple text box with some auto-complete functionality.
Convert the combo to a list box and continue here: viewtopic.php?f=13&t=76600&p=349166#p349166
Please, edit this topic’s initial post and add «[Solved]» to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
Torieth
- Posts: 10
- Joined: Wed Apr 29, 2015 2:23 pm
Re: Error Integrity constraint violation — no parent SYS_FK_
Post
by Torieth » Wed Apr 29, 2015 4:33 pm
Thanks for your answer, Villeroy. I’m a bit confused… I’m actually using a list box already as the combo box kept showing zeros in all fields.
Here are the tables I’m using
Production table (the onde I need to make form from)
Name: TAB_PRODUCTION
Fields:
- ID_PRODUCTION
- DATE
- SECTOR
- COLABORATOR
- QUANTITY
- REQUEST
- OBSERVATION
Request table
Name: TAB_REQUEST
Fields:
- ID_REQUEST
- REQUEST_NUMBER
- REQUEST_ENTRY
- Several fields containing details…
Sector table
Name: TAB_SECTOR
Fields:
- ID_SECTOR
- SECTOR
- Several fields containing details…
Colaborator table
Name: TAB_COLABORATOR
Fields:
- ID_COLABORATOR
- COLABORATOR
- Several fields containing details…
The fields REQUEST_NUMBER and REQUEST_ENTRY are together a single Request, I need that whenever I set a REQUEST_NUMBER and REQUEST_ENTRY combination into the form it gives me back always the same ID_REQUEST, no matter wich one. I thought that the «DISTINCT» modifier into the «SELECT» would give me only the first result for each REQUEST_NUMBER and REQUEST_ENTRY combination.
Apparently, I got that wrong and I think I’m getting the forms wrong altogether. I mean, into the list box there is the list I need to be and I can select the combination of REQUEST_NUMBER and REQUEST_ENTRY the way I imagined it. Why does it not track back the ID_REQUEST that gave that combination out?
Open Office 4.1.1
Windows XP SP 3
-
Villeroy
- Volunteer
- Posts: 31087
- Joined: Mon Oct 08, 2007 1:35 am
- Location: Germany
Re: Error Integrity constraint violation — no parent SYS_FK_
Post
by Villeroy » Wed Apr 29, 2015 4:43 pm
Your current list box selects only one concatenated field. A list box can use 2 fields, a visible one and hidden one to be written.
Following my recipe for a 2-column list box:
Linked field: REQUEST (a foreign key field of this form’s row set)
Source Type: SQL (or Query)
Source: SELECT DSITINCT «REQUEST_NUMBER» || ‘/’ || «REQUEST_ENTRY» AS «Visible», ID_REQUEST FROM «TAB_REQUEST» ORDER BY «Visible» (or the name of the query with this statement)
Bound Field: 1 (which is the second field, the primary key of the referred table TAB_REQUEST. The visible field would be 0)
Please, edit this topic’s initial post and add «[Solved]» to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
Torieth
- Posts: 10
- Joined: Wed Apr 29, 2015 2:23 pm
Re: Error Integrity constraint violation — no parent SYS_FK_
Post
by Torieth » Wed Apr 29, 2015 6:53 pm
It worked!
Thank you so much!
Then, it gave me some new doubts… xP
I think the list box will always show only the first field in the query, right? So, I can add as much fields as I wish to order it properly or is there a limit? I mean, look at this table:
Colaborator table
Name: TAB_COLABORATOR
Fields:
- ID_COLABORATOR
- COLABORATOR
- ID_SECTOR
- Several fields containing details…
I need to fill in the colaborator list box with the name of them, now it’s like this:
SELECT DISTINCT COLABORATOR , ID_COLABORATOR FROM TAB_COLABORATOR
It’s working fine, but, I’d like to order this list by sector and then by colaborator. Is it possible? I tried this:
SELECT DISTINCT COLABORATOR , ID_SECTOR, ID_COLABORATOR FROM TAB_COLABORATOR ORDER BY ID_SECTOR ASC, COLABORATOR ASC
It apparently works, but it shows the first query item in the list box and independently if a choose another item, whenever I change the focus from the list box it will come back to the first item.
Another thing is, I have several details from de request, after selected I’d like to show the request description as a way of confirmation. Can I do that somehow?
Open Office 4.1.1
Windows XP SP 3
-
Villeroy
- Volunteer
- Posts: 31087
- Joined: Mon Oct 08, 2007 1:35 am
- Location: Germany
Re: [Solved] Error Integrity constraint violation — no paren
Post
by Villeroy » Wed Apr 29, 2015 9:01 pm
You don’t need to select a column to order by.
SELECT A, B FROM X ORDER BY C works just fine.
or even
SELECT A, B FROM X ORDER BY (SELECT M FROM Y WHERE Y.A = X.Z)
which orders by a another table’s field using some related field(s) between the tables.
Please, edit this topic’s initial post and add «[Solved]» to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
Villeroy
- Volunteer
- Posts: 31087
- Joined: Mon Oct 08, 2007 1:35 am
- Location: Germany
Re: [Solved] Error Integrity constraint violation — no paren
Post
by Villeroy » Thu Apr 30, 2015 2:13 pm
Just compose a query with 2 columns, one visible and one with the other table’s primary key to be used as this form’s foreign key. The sort order should be ascending by the visible column because the alphabetical order makes it easier to spot things while typing.
The content of the visible field can be anything which helps to lookup the right primary key.
Please, edit this topic’s initial post and add «[Solved]» to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
Torieth
- Posts: 10
- Joined: Wed Apr 29, 2015 2:23 pm
Re: [Solved] Error Integrity constraint violation — no paren
Post
by Torieth » Thu Apr 30, 2015 3:16 pm
Villeroy, thank you for all this answers!
I have so many questions. Is there anywhere I can ask several newbie questions? I feel like this thread is not an optimal place to do it…
By field, I meant a form field, not a base field. I’d like to use the data inserted in the fields to filter the next form field query
And, I’d like to know why some list boxes show up the first query item and others don’t? I’d like all of them to be void initially.
Open Office 4.1.1
Windows XP SP 3
From NeoWiki
Jump to: navigation, search
Description
This error message appears in NeoBase.
The full text will be something like this:
Integrity constraint violation — no parent 4, table: Table A in statement [ALTER TABLE «Table A» ADD FOREIGN KEY («field name A») REFERENCES «Table B» («field name B»)
Cause
It occurs when you are trying to relate Table A to Table B by means of the two fields named. The field from table A («field name A») is called a Foreign Key (FK). Any field that links into another table (Table B, in this case) is called a Foreign Key. Remember that every table must have its own Primary Key (PK)
It means that there is data in field name A on one of the records in Table A that does not match any of the data in field name B on the records in Table B.
Solution
Check your data. Make certain that every record in table A has a value in field name A that can be matched to an instance of field name B.
An example:
Table A = Purchases | field name A = customer number |
Table B = Customers | field name B = customer ID |
customer number | customer ID |
0 | 3 |
1 | 4 |
2 | 5 |
The problem with the data frequently occurs when test data is entered by hand and it’s hard to keep track of the automatically created Primary Keys.
Всем спасибо.
В таблице продуктов — product_name VARCHAR2(25) PRIMARY KEY,
В таблице plsql101_purchase — product_name VARCHAR2(25),
В таблице plsql101_purchase тип поля — purchase_date DATE, буду знать, что лучше через to_date.
NLS-настроек сессии — можете сказать, что это в двух словах?
Там вообще по книге с датами что-то не то. При вставке в таблицу было так:
Oracle 11 SQL | ||
|
— у меня такой формат даты не проходил, пришлось менять на 12-02-45.
Там еще по таблице было ограничение:
Oracle 11 SQL | ||
|
TO_CHAR(purchase_date, ‘YYYY-MM-DD’) >= ‘2000-06-30’ — убрала это и все заработало, там даты раньше указанной даты.