dbTalk Databases Forums  

regrouping records

comp.databases.filemaker comp.databases.filemaker


Discuss regrouping records in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Frank
 
Posts: n/a

Default regrouping records - 05-27-2011 , 06:29 AM






I have a data based sorted by the first field name. In some records
I have the letters "SD" typed in at the end of the first field with a
space between the other data within that field on those records. Is
there any way I can group all of those records together so that the
data base is divided into two groups: those with "SD" in the first
field and those without the "SD" in the first field. I want each of
the groups to be sorted alphabetically as in the original.

Reply With Quote
  #2  
Old   
 
Posts: n/a

Default Re: regrouping records - 05-27-2011 , 06:44 AM






Create a calculation result number

cMyTest [right ( myfield ; 3) = " SD"]

The result will be a 1 if the field contains a space and SD at the and.

create a sort on two fields, first field cMyTest second field MyField (or
whatever is is called)

Hou je goed / keep well,

Ursus
"Frank" schreef in bericht
news:b9c97119-3528-4de4-95aa-647408c41970 (AT) hd10g2000vbb (DOT) googlegroups.com...

I have a data based sorted by the first field name. In some records
I have the letters "SD" typed in at the end of the first field with a
space between the other data within that field on those records. Is
there any way I can group all of those records together so that the
data base is divided into two groups: those with "SD" in the first
field and those without the "SD" in the first field. I want each of
the groups to be sorted alphabetically as in the original.

Reply With Quote
  #3  
Old   
cortical
 
Posts: n/a

Default Re: regrouping records - 05-29-2011 , 06:58 PM



On 27/05/11 8:59 PM, Frank wrote:
Quote:
I have a data based sorted by the first field name. In some records
I have the letters "SD" typed in at the end of the first field with a
space between the other data within that field on those records. Is
there any way I can group all of those records together so that the
data base is divided into two groups: those with "SD" in the first
field and those without the "SD" in the first field. I want each of
the groups to be sorted alphabetically as in the original.

It sounds like you are combining a name with a status (member of a
group). That is not a normalized field. Perhaps read up on Normalization
and First Normal Form (1NF).

Create a new field group_status_code, as a number field (0, 1). Format
the field on the layout for a boolean result, 0 = "" (blank) 1 = SD,
just for the display.

Create a simple script edit_toggle_group_status to toggle the status
value, and add to the field making the field a button.

set field group_status_code =
Let(
F = group_status_code
;
Case(
IsEmpty( F ) ; 1 ;
F = 1 ; 0 ;
F = 0 ; 1 ;
))


( add commit/refresh last steps)

Reply With Quote
  #4  
Old   
Keith
 
Posts: n/a

Default Re: regrouping records - 05-30-2011 , 08:34 AM



Thank you cortical but your solution is a bit too entailed for this
step of my project. If you have any more simplified solution, I'd like
to read it.

cortical wrote:
Quote:
On 27/05/11 8:59 PM, Frank wrote:
I have a data based sorted by the first field name. In some records
I have the letters "SD" typed in at the end of the first field with a
space between the other data within that field on those records. Is
there any way I can group all of those records together so that the
data base is divided into two groups: those with "SD" in the first
field and those without the "SD" in the first field. I want each of
the groups to be sorted alphabetically as in the original.


It sounds like you are combining a name with a status (member of a
group). That is not a normalized field. Perhaps read up on Normalization
and First Normal Form (1NF).

Create a new field group_status_code, as a number field (0, 1). Format
the field on the layout for a boolean result, 0 = "" (blank) 1 = SD,
just for the display.

Create a simple script edit_toggle_group_status to toggle the status
value, and add to the field making the field a button.

set field group_status_code =
Let(
F = group_status_code
;
Case(
IsEmpty( F ) ; 1 ;
F = 1 ; 0 ;
F = 0 ; 1 ;
))


( add commit/refresh last steps)

Reply With Quote
  #5  
Old   
Your Name
 
Posts: n/a

Default Re: regrouping records - 05-30-2011 , 04:22 PM



On 27/05/11 8:59 PM, Frank wrote:
Quote:
I have a data based sorted by the first field name. In some records
I have the letters "SD" typed in at the end of the first field with a
space between the other data within that field on those records. Is
there any way I can group all of those records together so that the
data base is divided into two groups: those with "SD" in the first
field and those without the "SD" in the first field. I want each of
the groups to be sorted alphabetically as in the original.
The easiest way would be to use a Calculation Field to copy the "SD" (if
it exists) from the end of the original Fields data,
e.g.
Has_SD Calculation, Text Result, Unstored
= If (Right(MyField; 2) = "SD"; "SD"; "")

If the last two characters of the data are SD, then this Field calculates
as SD. If the last two characters are not SD, then this Field calculates
as empty.

In the Sort window (either manually or via the Sort Script command) you
can set the Sort Order to be:

Has_SD Decreasing
MyField Increasing

Sorting Has_SD in Decreasing order means that the records with the "SD"
value are sorted before those with the empty value.

Helpful Harry )

Reply With Quote
  #6  
Old   
cortical
 
Posts: n/a

Default Re: regrouping records - 05-30-2011 , 06:18 PM



On 30/05/11 11:04 PM, Keith wrote:
Quote:
Thank you cortical but your solution is a bit too entailed for this
step of my project. If you have any more simplified solution, I'd like
to read it.


Remove the status/type/group (SD) data from the name field.




Quote:
cortical wrote:
On 27/05/11 8:59 PM, Frank wrote:
I have a data based sorted by the first field name. In some records
I have the letters "SD" typed in at the end of the first field with a
space between the other data within that field on those records. Is
there any way I can group all of those records together so that the
data base is divided into two groups: those with "SD" in the first
field and those without the "SD" in the first field. I want each of
the groups to be sorted alphabetically as in the original.


It sounds like you are combining a name with a status (member of a
group). That is not a normalized field. Perhaps read up on Normalization
and First Normal Form (1NF).

Create a new field group_status_code, as a number field (0, 1). Format
the field on the layout for a boolean result, 0 = "" (blank) 1 = SD,
just for the display.

Create a simple script edit_toggle_group_status to toggle the status
value, and add to the field making the field a button.

set field group_status_code =
Let(
F = group_status_code
;
Case(
IsEmpty( F ) ; 1 ;
F = 1 ; 0 ;
F = 0 ; 1 ;
))


( add commit/refresh last steps)

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.