A function to find errors in groups in a table

Started by Shaozhong SHIalmost 4 years ago5 messagesgeneral
Jump to latest
#1Shaozhong SHI
shishaozhong@gmail.com

There is a table full of grouped values like the following

nodeid link_type primary
11 outflowlink 1
11 inflowlink 1
11 outflowlink 2

Primary of 1 indicates a primary water course. Primary of 2 indicates a
secondary water course.

Obviously, one of the out flow links is an error, as its primacy value is
2. It is wrong that water flows from a primary water course into a
secondary water course.

How can a function can be designed to find and report such errors?

Regards,

David

#2Shaozhong SHI
shishaozhong@gmail.com
In reply to: Shaozhong SHI (#1)

There is a table full of grouped values like the following

nodeid link_type primary
11 outflowlink 1
11 inflowlink 1
11 outflowlink 2

Primary of 1 indicates a primary water course. Primary of 2 indicates a
secondary water course.

Obviously, one of the out flow links is an error, as its primacy value is
2. It is wrong that water flows from a primary water course into a
secondary water course.

How can a function can be designed to find and report such errors?

Regards,

David

#3Steve Midgley
science@misuse.org
In reply to: Shaozhong SHI (#1)
Re: A function to find errors in groups in a table

On Thu, Jun 9, 2022 at 6:37 AM Shaozhong SHI <shishaozhong@gmail.com> wrote:

There is a table full of grouped values like the following

nodeid link_type primary
11 outflowlink 1
11 inflowlink 1
11 outflowlink 2

Primary of 1 indicates a primary water course. Primary of 2 indicates a
secondary water course.

Obviously, one of the out flow links is an error, as its primacy value is
2. It is wrong that water flows from a primary water course into a
secondary water course.

How can a function can be designed to find and report such errors?

Is the problem that there exists this row:

11 outflowlink 2

But there is no corresponding row:

11 inflowlink 2

So that you need to find all "orphan" rows that don't have a corresponding
member with the opposing data field inflowlink or outflowlink where the
"primary" column is the join field between the two rows?

Thanks for clarifying your problem,
Steve

#4Shaozhong SHI
shishaozhong@gmail.com
In reply to: Steve Midgley (#3)
Re: A function to find errors in groups in a table

The first two can be regarded right. Certainly, the last one must be
wrong. How can a primary flow get into a secondary flow?

That is odd.

Regards,

David

On Thursday, 9 June 2022, Steve Midgley <science@misuse.org> wrote:

Show quoted text

On Thu, Jun 9, 2022 at 6:37 AM Shaozhong SHI <shishaozhong@gmail.com>
wrote:

There is a table full of grouped values like the following

nodeid link_type primary
11 outflowlink 1
11 inflowlink 1
11 outflowlink 2

Primary of 1 indicates a primary water course. Primary of 2 indicates a
secondary water course.

Obviously, one of the out flow links is an error, as its primacy value is
2. It is wrong that water flows from a primary water course into a
secondary water course.

How can a function can be designed to find and report such errors?

Is the problem that there exists this row:

11 outflowlink 2

But there is no corresponding row:

11 inflowlink 2

So that you need to find all "orphan" rows that don't have a corresponding
member with the opposing data field inflowlink or outflowlink where the
"primary" column is the join field between the two rows?

Thanks for clarifying your problem,
Steve

#5Steve Midgley
science@misuse.org
In reply to: Shaozhong SHI (#4)
Re: A function to find errors in groups in a table

On Thu, Jun 9, 2022 at 4:13 PM Shaozhong SHI <shishaozhong@gmail.com> wrote:

The first two can be regarded right. Certainly, the last one must be
wrong. How can a primary flow get into a secondary flow?

That is odd.

Regards,

David

On Thursday, 9 June 2022, Steve Midgley <science@misuse.org> wrote:

On Thu, Jun 9, 2022 at 6:37 AM Shaozhong SHI <shishaozhong@gmail.com>
wrote:

There is a table full of grouped values like the following

nodeid link_type primary
11 outflowlink 1
11 inflowlink 1
11 outflowlink 2

Primary of 1 indicates a primary water course. Primary of 2 indicates a
secondary water course.

Obviously, one of the out flow links is an error, as its primacy value
is 2. It is wrong that water flows from a primary water course into a
secondary water course.

How can a function can be designed to find and report such errors?

Is the problem that there exists this row:

11 outflowlink 2

But there is no corresponding row:

11 inflowlink 2

So that you need to find all "orphan" rows that don't have a
corresponding member with the opposing data field inflowlink or
outflowlink where the "primary" column is the join field between the two
rows?

You didn't answer my question, at least in a way I can understand, which
makes it hard to give you useful input on a solution.. Also, please try to
bottom post. This list asks posters to reply at the bottom of each email.

Steve