Simplicty and flexibility!


Preventing Redundant Record Export


Started by Bolt-on-Trailers
Search
You will need to Sign In to be able to add or comment on the forum!

Preventing Redundant Record Export

Download: Error.JPG

HI All,

I have a table with redundant records. I need to export the data to a text file but I only want one occurrence of each record exported. For example.. Suppose I have a "Names" table with multiple John Doe records. I can list the records in groups but how do I export the records in groups? The following script below does not work. I get an (see uploaded image) error. I'm sure it is a simple fix. Your help would be greatly appreciated. Thank You..

for Names ;
List records
LastName in groups ;
FirstName in groups .
end
export to "c:\ExportData\ExpData.txt" .
.form header
LAST NAME`FIRST NAME
.items
@f[1,1]`@f[1,2]
.end


Written by Bolt-on-Trailers 25/01/18 at 19:04:10 Dataease [{8}]FIVE

Re:Preventing Redundant Record Export

Redundancy is the eye of the beholder...

You will have to define what that means ;-)

However lets say that if both FirstName and LastName is the same it is redundant you do it like this:

define "vFirstName" text .
define "vlastName" text .
for Names ;

if vLastname not=LastName and vFirstName not=firstname

List records

LastName in order ;
FirstName  in order .

vLastname :=LastName .
vFirstName := FirstName .

end

end
export to "c:\ExportData\ExpData.txt" .
.form header
LAST NAME`FIRST NAME
.items
@f[1,1]`@f[1,2]
.end

You can do it with groups too but its more awkward and I'm not sure how good this export format is on groups.


Written by DataEase 25/01/18 at 20:13:53 Dataease [{8}]FIVE

Re:Re:Preventing Redundant Record Export

Thank you. That worked great.


Written by Bolt-on-Trailers 25/01/18 at 21:42:48 Dataease [{8}]FIVE

Re:Re:Re:Preventing Redundant Record Export

Oops. I lied it didn't work. Suppose I have 2 or more records with the first name of John and the last name of Doe. I only want one John Doe record exported. I don't need all of them exported. This wouldn't be a case where both the first and last names are the same.


Written by Bolt-on-Trailers 25/01/18 at 22:11:27 Dataease [{8}]FIVE

Re:Re:Re:Re:Preventing Redundant Record Export

Sorry.

Boolean problem.

it should of course be or and not and in the if.

if vLastname not=LastName or vFirstName not=firstname then

All of it.

define "vFirstName" text .

define "vlastName" text .

for Names ;

if vLastname not=LastName or vFirstName not=firstname then

List records

LastName in order ;

FirstName in order .

vLastname :=LastName .

vFirstName := FirstName .

end

end

export to "c:\ExportData\ExpData.txt" .

.form header

LAST NAME`FIRST NAME

.items

@f[1,1]`@f[1,2]

.end


Written by DataEase 26/01/18 at 10:12:08 Dataease [{8}]FIVE

Re:Re:Re:Re:Re:Preventing Redundant Record Export

Download Sample

This way of exporting is outdated as it was never very good and was just added as an afterthought back in 1995 when they realised that you couldn't export from DQL...

ExecDQL is a better way of generating exports.

The funny thing is also that your DQL actually work out of the box in ExecDQL as it attack the columns and sections in a different way (i.e. more like DFD).

Attached a quick sample.


Written by DataEase 26/01/18 at 11:04:26 Dataease [{8}]FIVE
DG3_ForumList