In Access: group of records and assign conditional group ?
-
In Access I want to group and assign data according to conditions with 2 values 0 and 1 (true or false) and with the condition NGAYGIAO>= #01/01/2019# and NGAYGIAO <=# 31/01/2019# me How to write commands ? The data I put in the excel file consists of two sheets: Original data and Result, where Original data is the original data sheet that is the result of the problem I need, when running the access issue, ask you to help me with the problem. http://www.mediafire.com/file/hkkw519bw2k3o9h/baitap\_data2.xls/file
-
In Access I want to group and assign data according to conditions with 2 values 0 and 1 (true or false) and with the condition NGAYGIAO>= #01/01/2019# and NGAYGIAO <=# 31/01/2019# me How to write commands ? The data I put in the excel file consists of two sheets: Original data and Result, where Original data is the original data sheet that is the result of the problem I need, when running the access issue, ask you to help me with the problem. http://www.mediafire.com/file/hkkw519bw2k3o9h/baitap\_data2.xls/file
Your problem description is not very clear, so it's hard to guess what you do and what you need... However, you could rewrite your condition for NGAYGIAO as
NGAYGIAO BETWEEN #01/01/2019# AND #31/01/2019#
which looks more readable.
-
In Access I want to group and assign data according to conditions with 2 values 0 and 1 (true or false) and with the condition NGAYGIAO>= #01/01/2019# and NGAYGIAO <=# 31/01/2019# me How to write commands ? The data I put in the excel file consists of two sheets: Original data and Result, where Original data is the original data sheet that is the result of the problem I need, when running the access issue, ask you to help me with the problem. http://www.mediafire.com/file/hkkw519bw2k3o9h/baitap\_data2.xls/file
Add a derived column to your selection where the definition is as follows: =IIF(NGAYGIAO BETWEEN #01/01/2019# and #31/01/2019 23:59:59#,true,false) You can then sort and group by this column
========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================
-
Your problem description is not very clear, so it's hard to guess what you do and what you need... However, you could rewrite your condition for NGAYGIAO as
NGAYGIAO BETWEEN #01/01/2019# AND #31/01/2019#
which looks more readable.
from the original data I created the result, if the contract in the month has LOAIHD = "FBAN" and between (#01/01/2019# and #31/01/2019#) then [BOOL] = 1 else [BOOL = 0, I will describe the condition of [BOOL] in C# code
for (int i = 0; i < [Original data].Count; i++)
{
bool BOOLEAN = 0;
string SOHD = "";
if([NGAYGIAO].[i]>=#1/1/2019# && [NGAYGIAO].[i] <=#1/31/2019#) //dd/MM/yyyy
{
for (int j = 0; j < [Original data].Count; j++)
{
if([LOAIHD].[j] == "FBAN")
{
BOOLEAN = 1;
SOHD = [Original data].[HD].[j];
}
}
}
if(SOHD == [Original data].[HD].[i] && SOHD != "")
{
[Result].[BOOL].[i] = BOOLEAN;
}
} -
Your problem description is not very clear, so it's hard to guess what you do and what you need... However, you could rewrite your condition for NGAYGIAO as
NGAYGIAO BETWEEN #01/01/2019# AND #31/01/2019#
which looks more readable.
from the original data I created the result, if the contract in the month has LOAIHD = "FBAN" and between (#01/01/2019# and #31/01/2019#) then [BOOL] = 1 else [BOOL = 0, I will describe the condition of [BOOL] in C# code [CODE] for (int i = 0; i < [Original data].Count; i++) { bool BOOLEAN = 0; string SOHD = ""; if([NGAYGIAO].[i]>=#1/1/2019# && [NGAYGIAO].[i] <=#1/31/2019#) //dd/MM/yyyy { for (int j = 0; j < [Original data].Count; j++) { if([LOAIHD].[j] == "FBAN") { BOOLEAN = 1; SOHD = [Original data].[HD].[j]; } } } if(SOHD == [Original data].[HD].[i] && SOHD != "") { [Result].[BOOL].[i] = BOOLEAN; } } [/CODE]