![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi all, I am trying to provide an indicator on a form to highlight every 10th occurrence of a Formulation, so this Batch must be sent for testing. I have already provided a query grouping the relevant Formulations together. Now I want to put a sequenced count, Counter, on this query as follows: Formulation Counter Batch No A 1 B321 B 1 B127 B 2 B223 B 3 B234 : : : : : : B 9 B665 B 10 B765 C 1 B123 ETC. One possibility is to set up a table called NextCounter with 10 records, 1 to 10. Then associate this table with the query such that the query searches through the NextCounter and on reaching the 10th value returns to 1st value. This is all very well in theory, but am not aware of the code needed to do this. Can anyone suggest an existing function or method to provide this counter? Thanks in advance, Julie |
#3
| |||
| |||
|
|
Hi all, I am trying to provide an indicator on a form to highlight every 10th occurrence of a Formulation, so this Batch must be sent for testing. I have already provided a query grouping the relevant Formulations together. Now I want to put a sequenced count, Counter, on this query as follows: Formulation Counter Batch No A 1 B321 B 1 B127 B 2 B223 B 3 B234 : : : : : : B 9 B665 B 10 B765 C 1 B123 ETC. One possibility is to set up a table called NextCounter with 10 records, 1 to 10. Then associate this table with the query such that the query searches through the NextCounter and on reaching the 10th value returns to 1st value. This is all very well in theory, but am not aware of the code needed to do this. Can anyone suggest an existing function or method to provide this counter? Thanks in advance, Julie |
#4
| |||
| |||
|
|
I think you can easily use a Mod function for this - Mod of 10 - if there's no remainder then it's the 10th item (or every 10th item).....I think the function is just Mod..... juliebannon (AT) yahoo (DOT) co.uk (Julie) wrote in message news:<d528d765.0311100313.2ffff12c (AT) posting (DOT) google.com>... Hi all, I am trying to provide an indicator on a form to highlight every 10th occurrence of a Formulation, so this Batch must be sent for testing. I have already provided a query grouping the relevant Formulations together. Now I want to put a sequenced count, Counter, on this query as follows: Formulation Counter Batch No A 1 B321 B 1 B127 B 2 B223 B 3 B234 : : : : : : B 9 B665 B 10 B765 C 1 B123 ETC. One possibility is to set up a table called NextCounter with 10 records, 1 to 10. Then associate this table with the query such that the query searches through the NextCounter and on reaching the 10th value returns to 1st value. This is all very well in theory, but am not aware of the code needed to do this. Can anyone suggest an existing function or method to provide this counter? Thanks in advance, Julie |
#5
| |||
| |||
|
|
The difficulty was in actually inserting a "counter" to distinguish the number per group. There after i can easily extract any Mod10=0 . However I managed to find code in SQL for this: SELECT j1.TrimVenla, COUNT(*) AS line_number FROM [SELECT id, QueryFormulations.TrimVenla FROM QueryFormulations GROUP BY id, QueryFormulations.TrimVenla]. AS j1 INNER JOIN [SELECT id, QueryFormulations.TrimVenla FROM QueryFormulations GROUP BY id, QueryFormulations.TrimVenla]. AS j2 ON (j1.id >= j2.id) AND (j1.QueryFormulations.TrimVenla = j2.QueryFormulations.TrimVenla) GROUP BY j1.QueryFormulations.TrimVenla, j1.id ORDER BY j1.QueryFormulations.TrimVenla, COUNT(*); This works partly but I still have an issue trying to add in the third required field, Batch No. I need to identify the 10th Batch No to be sent for testing. Any feedback on this is greatly appreciated. Regards, Julie MeadeR (AT) ComputerSOSNJ (DOT) com (MeadeR) wrote in message news:<32684913.0311101130.f7549e8 (AT) posting (DOT) google.com>... I think you can easily use a Mod function for this - Mod of 10 - if there's no remainder then it's the 10th item (or every 10th item).....I think the function is just Mod..... juliebannon (AT) yahoo (DOT) co.uk (Julie) wrote in message news:<d528d765.0311100313.2ffff12c (AT) posting (DOT) google.com>... Hi all, I am trying to provide an indicator on a form to highlight every 10th occurrence of a Formulation, so this Batch must be sent for testing. I have already provided a query grouping the relevant Formulations together. Now I want to put a sequenced count, Counter, on this query as follows: Formulation Counter Batch No A 1 B321 B 1 B127 B 2 B223 B 3 B234 : : : : : : B 9 B665 B 10 B765 C 1 B123 ETC. One possibility is to set up a table called NextCounter with 10 records, 1 to 10. Then associate this table with the query such that the query searches through the NextCounter and on reaching the 10th value returns to 1st value. This is all very well in theory, but am not aware of the code needed to do this. Can anyone suggest an existing function or method to provide this counter? Thanks in advance, Julie |
#6
| |||
| |||
|
|
The difficulty was in actually inserting a "counter" to distinguish the number per group. There after i can easily extract any Mod10=0 . However I managed to find code in SQL for this: SELECT j1.TrimVenla, COUNT(*) AS line_number FROM [SELECT id, QueryFormulations.TrimVenla FROM QueryFormulations GROUP BY id, QueryFormulations.TrimVenla]. AS j1 INNER JOIN [SELECT id, QueryFormulations.TrimVenla FROM QueryFormulations GROUP BY id, QueryFormulations.TrimVenla]. AS j2 ON (j1.id >= j2.id) AND (j1.QueryFormulations.TrimVenla = j2.QueryFormulations.TrimVenla) GROUP BY j1.QueryFormulations.TrimVenla, j1.id ORDER BY j1.QueryFormulations.TrimVenla, COUNT(*); This works partly but I still have an issue trying to add in the third required field, Batch No. I need to identify the 10th Batch No to be sent for testing. Any feedback on this is greatly appreciated. Regards, Julie MeadeR (AT) ComputerSOSNJ (DOT) com (MeadeR) wrote in message news:<32684913.0311101130.f7549e8 (AT) posting (DOT) google.com>... I think you can easily use a Mod function for this - Mod of 10 - if there's no remainder then it's the 10th item (or every 10th item).....I think the function is just Mod..... juliebannon (AT) yahoo (DOT) co.uk (Julie) wrote in message news:<d528d765.0311100313.2ffff12c (AT) posting (DOT) google.com>... Hi all, I am trying to provide an indicator on a form to highlight every 10th occurrence of a Formulation, so this Batch must be sent for testing. I have already provided a query grouping the relevant Formulations together. Now I want to put a sequenced count, Counter, on this query as follows: Formulation Counter Batch No A 1 B321 B 1 B127 B 2 B223 B 3 B234 : : : : : : B 9 B665 B 10 B765 C 1 B123 ETC. One possibility is to set up a table called NextCounter with 10 records, 1 to 10. Then associate this table with the query such that the query searches through the NextCounter and on reaching the 10th value returns to 1st value. This is all very well in theory, but am not aware of the code needed to do this. Can anyone suggest an existing function or method to provide this counter? Thanks in advance, Julie |
![]() |
| Thread Tools | |
| Display Modes | |
| |