Beginners Question: couting to 81and then repeating.

Beginners Question: couting to 81and then repeating.

Post by Mark Fo » Sun, 05 Jan 2003 12:30:02



Hi All,

I have been having a problem that I do not quite understand. It might
be simple, but I have not found anything in the manuals or on the web.

I have constructed a database to store items in boxes that have 81 slots in
them.
I would like to have the database allocated the position of each item in the
box
from 1 to 81. When it reaches 81 I want it to return to 1 and start again
for another box.
I have managed to work out a calculation to give the new box a new name but
I
cannot work out how to get the database to start from one again. Is it
possible
to do what I am asking.

Thanks in advance and I do apologize if this is a basic thing.

Mark

 
 
 

Beginners Question: couting to 81and then repeating.

Post by John Weinshe » Sun, 05 Jan 2003 13:05:47


It's more of a conceptual than a Filemaker problem. It's not clear to me
whether you are trying to create a certain number of records, all at once,
that will assign a serial number from 1 to 81, and then start over again,
for x number of records, or if you want to assign that number when a new
record is added (i.e., one at a time). I'm also unsure where the 'new name'
comes in, unless by that you merely mean that number from 1 to 81.

Roughly, if you want them all at once, you build an 'outer' loop that
resumes whenever an 'inner' loop reaches 81. Each inner loop step creates a
new record, while incrementing the inner counter. When the inner counter
reaches 81, the inner loop exits and the outer counter increments, and the
inner loop starts again, and the inner counter starts over again at 1. The
whole shebang ends when the outer loop (number of boxes) reaches whatever
number you set.

If you need the records added one at a time, create a self-join (from a file
to iteself) relationship ('Box') based on the Box_Number field, and script
the creation of new records, looking for the highest value up to 81. You'll
need a calculation field ('Constant'), returning a number and defined as 1,
and a 'Constant' relationship from Constant to itself (in other words, a
relationship to all the records in the file).

New Record/Request
If [Max(Box::Slot_Number) < 81]
   Set Field["Box_Number", Max(Constant::Box_Number""]
   Set Field["Slot_Number", "Max(Box::Box_Number) +1"]
   Else
   Set Field["Box_Number", "Max(Constant::Box_Number) +1"]
   Set Field["Slot_Number", "1"]
End If

...where 'Slot_Number' is the number of the slot, from 1 to 81.

Let us know if that description comes close to what you need.
--
John Weinshel
Datagrace
Associate Member, Filemaker Solutions Alliance
Vashon Island, WA
(206) 463-1634


Quote:> Hi All,

> I have been having a problem that I do not quite understand. It might
> be simple, but I have not found anything in the manuals or on the web.

> I have constructed a database to store items in boxes that have 81 slots
in
> them.
> I would like to have the database allocated the position of each item in
the
> box
> from 1 to 81. When it reaches 81 I want it to return to 1 and start again
> for another box.
> I have managed to work out a calculation to give the new box a new name
but
> I
> cannot work out how to get the database to start from one again. Is it
> possible
> to do what I am asking.

> Thanks in advance and I do apologize if this is a basic thing.

> Mark


 
 
 

Beginners Question: couting to 81and then repeating.

Post by Mark Fo » Mon, 06 Jan 2003 01:50:22


Thanks John,

I do apolagize that my question was not clear.

I would like the number calculated each time I create a new record. As i
enter my items into the database one at a time i would like FM to give that
item a position in a box and to determine which box that is eg. Starting
with box A the first item would go to position 1, the next position 2 until
it reaches 81. At this point FM would move to a new box (called B) and then
start from one again. I hope that is clearer.

With this in mind i think your New record appoarch is what i am looking for.

Unfortunaletly my understanding of FM is still limited so i do not fully
understand the constant calculation.

Time to hit the books.

Many thanks

Mark


> It's more of a conceptual than a Filemaker problem. It's not clear to me
> whether you are trying to create a certain number of records, all at once,
> that will assign a serial number from 1 to 81, and then start over again,
> for x number of records, or if you want to assign that number when a new
> record is added (i.e., one at a time). I'm also unsure where the 'new
name'
> comes in, unless by that you merely mean that number from 1 to 81.

> Roughly, if you want them all at once, you build an 'outer' loop that
> resumes whenever an 'inner' loop reaches 81. Each inner loop step creates
a
> new record, while incrementing the inner counter. When the inner counter
> reaches 81, the inner loop exits and the outer counter increments, and the
> inner loop starts again, and the inner counter starts over again at 1. The
> whole shebang ends when the outer loop (number of boxes) reaches whatever
> number you set.

> If you need the records added one at a time, create a self-join (from a
file
> to iteself) relationship ('Box') based on the Box_Number field, and script
> the creation of new records, looking for the highest value up to 81.
You'll
> need a calculation field ('Constant'), returning a number and defined as
1,
> and a 'Constant' relationship from Constant to itself (in other words, a
> relationship to all the records in the file).

> New Record/Request
> If [Max(Box::Slot_Number) < 81]
>    Set Field["Box_Number", Max(Constant::Box_Number""]
>    Set Field["Slot_Number", "Max(Box::Box_Number) +1"]
>    Else
>    Set Field["Box_Number", "Max(Constant::Box_Number) +1"]
>    Set Field["Slot_Number", "1"]
> End If

> ...where 'Slot_Number' is the number of the slot, from 1 to 81.

> Let us know if that description comes close to what you need.
> --
> John Weinshel
> Datagrace
> Associate Member, Filemaker Solutions Alliance
> Vashon Island, WA
> (206) 463-1634



> > Hi All,

> > I have been having a problem that I do not quite understand. It might
> > be simple, but I have not found anything in the manuals or on the web.

> > I have constructed a database to store items in boxes that have 81 slots
> in
> > them.
> > I would like to have the database allocated the position of each item in
> the
> > box
> > from 1 to 81. When it reaches 81 I want it to return to 1 and start
again
> > for another box.
> > I have managed to work out a calculation to give the new box a new name
> but
> > I
> > cannot work out how to get the database to start from one again. Is it
> > possible
> > to do what I am asking.

> > Thanks in advance and I do apologize if this is a basic thing.

> > Mark

 
 
 

Beginners Question: couting to 81and then repeating.

Post by John Weinshe » Mon, 06 Jan 2003 02:48:57


'Constant' (either the field or the relationship) can be called anything you
want ('One', '1', 'All' are common). Define a claculation field
("Constant'), returning a number, as the number 1. Now create a relationship
(let's call it 'Con_Rel') from Constant to Constant. Thus, a portal showing
records from Con_Rel can display all the records in the file. It's a
one-to-all relationship-- useful when you need to poll the entire file for
some purposes, such as finding the highest value.

Using letters instead of numbers for the Box names poses a bit of a problem,
because the Max() function will not operate against text (as in
Max(Constant::Box_Number) ). There are ways around this issue, but is there
any reason you can't name the boxes numbers (in number fields)?
--
John Weinshel
Datagrace
Associate Member, Filemaker Solutions Alliance
Vashon Island, WA
(206) 463-1634


> Thanks John,

> I do apolagize that my question was not clear.

> I would like the number calculated each time I create a new record. As i
> enter my items into the database one at a time i would like FM to give
that
> item a position in a box and to determine which box that is eg. Starting
> with box A the first item would go to position 1, the next position 2
until
> it reaches 81. At this point FM would move to a new box (called B) and
then
> start from one again. I hope that is clearer.

> With this in mind i think your New record appoarch is what i am looking
for.

> Unfortunaletly my understanding of FM is still limited so i do not fully
> understand the constant calculation.

> Time to hit the books.

> Many thanks

> Mark



> > It's more of a conceptual than a Filemaker problem. It's not clear to me
> > whether you are trying to create a certain number of records, all at
once,
> > that will assign a serial number from 1 to 81, and then start over
again,
> > for x number of records, or if you want to assign that number when a new
> > record is added (i.e., one at a time). I'm also unsure where the 'new
> name'
> > comes in, unless by that you merely mean that number from 1 to 81.

> > Roughly, if you want them all at once, you build an 'outer' loop that
> > resumes whenever an 'inner' loop reaches 81. Each inner loop step
creates
> a
> > new record, while incrementing the inner counter. When the inner counter
> > reaches 81, the inner loop exits and the outer counter increments, and
the
> > inner loop starts again, and the inner counter starts over again at 1.
The
> > whole shebang ends when the outer loop (number of boxes) reaches
whatever
> > number you set.

> > If you need the records added one at a time, create a self-join (from a
> file
> > to iteself) relationship ('Box') based on the Box_Number field, and
script
> > the creation of new records, looking for the highest value up to 81.
> You'll
> > need a calculation field ('Constant'), returning a number and defined as
> 1,
> > and a 'Constant' relationship from Constant to itself (in other words, a
> > relationship to all the records in the file).

> > New Record/Request
> > If [Max(Box::Slot_Number) < 81]
> >    Set Field["Box_Number", Max(Constant::Box_Number""]
> >    Set Field["Slot_Number", "Max(Box::Box_Number) +1"]
> >    Else
> >    Set Field["Box_Number", "Max(Constant::Box_Number) +1"]
> >    Set Field["Slot_Number", "1"]
> > End If

> > ...where 'Slot_Number' is the number of the slot, from 1 to 81.

> > Let us know if that description comes close to what you need.
> > --
> > John Weinshel
> > Datagrace
> > Associate Member, Filemaker Solutions Alliance
> > Vashon Island, WA
> > (206) 463-1634



> > > Hi All,

> > > I have been having a problem that I do not quite understand. It might
> > > be simple, but I have not found anything in the manuals or on the web.

> > > I have constructed a database to store items in boxes that have 81
slots
> > in
> > > them.
> > > I would like to have the database allocated the position of each item
in
> > the
> > > box
> > > from 1 to 81. When it reaches 81 I want it to return to 1 and start
> again
> > > for another box.
> > > I have managed to work out a calculation to give the new box a new
name
> > but
> > > I
> > > cannot work out how to get the database to start from one again. Is it
> > > possible
> > > to do what I am asking.

> > > Thanks in advance and I do apologize if this is a basic thing.

> > > Mark

 
 
 

Beginners Question: couting to 81and then repeating.

Post by Mark Fo » Mon, 06 Jan 2003 05:13:09


Hope there is no reason why i can't name the boxes numbers in the number
fields.

Mark


> 'Constant' (either the field or the relationship) can be called anything
you
> want ('One', '1', 'All' are common). Define a claculation field
> ("Constant'), returning a number, as the number 1. Now create a
relationship
> (let's call it 'Con_Rel') from Constant to Constant. Thus, a portal
showing
> records from Con_Rel can display all the records in the file. It's a
> one-to-all relationship-- useful when you need to poll the entire file for
> some purposes, such as finding the highest value.

> Using letters instead of numbers for the Box names poses a bit of a
problem,
> because the Max() function will not operate against text (as in
> Max(Constant::Box_Number) ). There are ways around this issue, but is
there
> any reason you can't name the boxes numbers (in number fields)?
> --
> John Weinshel
> Datagrace
> Associate Member, Filemaker Solutions Alliance
> Vashon Island, WA
> (206) 463-1634



> > Thanks John,

> > I do apolagize that my question was not clear.

> > I would like the number calculated each time I create a new record. As i
> > enter my items into the database one at a time i would like FM to give
> that
> > item a position in a box and to determine which box that is eg. Starting
> > with box A the first item would go to position 1, the next position 2
> until
> > it reaches 81. At this point FM would move to a new box (called B) and
> then
> > start from one again. I hope that is clearer.

> > With this in mind i think your New record appoarch is what i am looking
> for.

> > Unfortunaletly my understanding of FM is still limited so i do not fully
> > understand the constant calculation.

> > Time to hit the books.

> > Many thanks

> > Mark



> > > It's more of a conceptual than a Filemaker problem. It's not clear to
me
> > > whether you are trying to create a certain number of records, all at
> once,
> > > that will assign a serial number from 1 to 81, and then start over
> again,
> > > for x number of records, or if you want to assign that number when a
new
> > > record is added (i.e., one at a time). I'm also unsure where the 'new
> > name'
> > > comes in, unless by that you merely mean that number from 1 to 81.

> > > Roughly, if you want them all at once, you build an 'outer' loop that
> > > resumes whenever an 'inner' loop reaches 81. Each inner loop step
> creates
> > a
> > > new record, while incrementing the inner counter. When the inner
counter
> > > reaches 81, the inner loop exits and the outer counter increments, and
> the
> > > inner loop starts again, and the inner counter starts over again at 1.
> The
> > > whole shebang ends when the outer loop (number of boxes) reaches
> whatever
> > > number you set.

> > > If you need the records added one at a time, create a self-join (from
a
> > file
> > > to iteself) relationship ('Box') based on the Box_Number field, and
> script
> > > the creation of new records, looking for the highest value up to 81.
> > You'll
> > > need a calculation field ('Constant'), returning a number and defined
as
> > 1,
> > > and a 'Constant' relationship from Constant to itself (in other words,
a
> > > relationship to all the records in the file).

> > > New Record/Request
> > > If [Max(Box::Slot_Number) < 81]
> > >    Set Field["Box_Number", Max(Constant::Box_Number""]
> > >    Set Field["Slot_Number", "Max(Box::Box_Number) +1"]
> > >    Else
> > >    Set Field["Box_Number", "Max(Constant::Box_Number) +1"]
> > >    Set Field["Slot_Number", "1"]
> > > End If

> > > ...where 'Slot_Number' is the number of the slot, from 1 to 81.

> > > Let us know if that description comes close to what you need.
> > > --
> > > John Weinshel
> > > Datagrace
> > > Associate Member, Filemaker Solutions Alliance
> > > Vashon Island, WA
> > > (206) 463-1634



> > > > Hi All,

> > > > I have been having a problem that I do not quite understand. It
might
> > > > be simple, but I have not found anything in the manuals or on the
web.

> > > > I have constructed a database to store items in boxes that have 81
> slots
> > > in
> > > > them.
> > > > I would like to have the database allocated the position of each
item
> in
> > > the
> > > > box
> > > > from 1 to 81. When it reaches 81 I want it to return to 1 and start
> > again
> > > > for another box.
> > > > I have managed to work out a calculation to give the new box a new
> name
> > > but
> > > > I
> > > > cannot work out how to get the database to start from one again. Is
it
> > > > possible
> > > > to do what I am asking.

> > > > Thanks in advance and I do apologize if this is a basic thing.

> > > > Mark

 
 
 

Beginners Question: couting to 81and then repeating.

Post by Kent at hom » Mon, 06 Jan 2003 05:36:51


Another shot:
--
1) A simple serial number, starting at 1, incrementing by 1.
"serial"
2) a Calculated Box field:
Box=Truncate((serial-1)/81,0)+1
3) A calculated compartment field:
Compartment=serial-(Truncate( (serial-1)/81, 0 )*81)
--
This should also work for simply importing a list if you have it set to update
serials while importing.

Kent

"Mark Fox" wrote...
> Thanks John,

> I do apolagize that my question was not clear.

> I would like the number calculated each time I create a new record. As i
> enter my items into the database one at a time i would like FM to give that
> item a position in a box and to determine which box that is eg. Starting
> with box A the first item would go to position 1, the next position 2 until
> it reaches 81. At this point FM would move to a new box (called B) and then
> start from one again. I hope that is clearer.

> With this in mind i think your New record appoarch is what i am looking for.

> Unfortunaletly my understanding of FM is still limited so i do not fully
> understand the constant calculation.

> Time to hit the books.

> Many thanks

> Mark



> > It's more of a conceptual than a Filemaker problem. It's not clear to me
> > whether you are trying to create a certain number of records, all at once,
> > that will assign a serial number from 1 to 81, and then start over again,
> > for x number of records, or if you want to assign that number when a new
> > record is added (i.e., one at a time). I'm also unsure where the 'new
> name'
> > comes in, unless by that you merely mean that number from 1 to 81.

> > Roughly, if you want them all at once, you build an 'outer' loop that
> > resumes whenever an 'inner' loop reaches 81. Each inner loop step creates
> a
> > new record, while incrementing the inner counter. When the inner counter
> > reaches 81, the inner loop exits and the outer counter increments, and the
> > inner loop starts again, and the inner counter starts over again at 1. The
> > whole shebang ends when the outer loop (number of boxes) reaches whatever
> > number you set.

> > If you need the records added one at a time, create a self-join (from a
> file
> > to iteself) relationship ('Box') based on the Box_Number field, and script
> > the creation of new records, looking for the highest value up to 81.
> You'll
> > need a calculation field ('Constant'), returning a number and defined as
> 1,
> > and a 'Constant' relationship from Constant to itself (in other words, a
> > relationship to all the records in the file).

> > New Record/Request
> > If [Max(Box::Slot_Number) < 81]
> >    Set Field["Box_Number", Max(Constant::Box_Number""]
> >    Set Field["Slot_Number", "Max(Box::Box_Number) +1"]
> >    Else
> >    Set Field["Box_Number", "Max(Constant::Box_Number) +1"]
> >    Set Field["Slot_Number", "1"]
> > End If

> > ...where 'Slot_Number' is the number of the slot, from 1 to 81.

> > Let us know if that description comes close to what you need.
> > --
> > John Weinshel
> > Datagrace
> > Associate Member, Filemaker Solutions Alliance
> > Vashon Island, WA
> > (206) 463-1634



> > > Hi All,

> > > I have been having a problem that I do not quite understand. It might
> > > be simple, but I have not found anything in the manuals or on the web.

> > > I have constructed a database to store items in boxes that have 81 slots
> > in
> > > them.
> > > I would like to have the database allocated the position of each item in
> > the
> > > box
> > > from 1 to 81. When it reaches 81 I want it to return to 1 and start
> again
> > > for another box.
> > > I have managed to work out a calculation to give the new box a new name
> > but
> > > I
> > > cannot work out how to get the database to start from one again. Is it
> > > possible
> > > to do what I am asking.

> > > Thanks in advance and I do apologize if this is a basic thing.

> > > Mark