월 시작과 오늘 날짜 사이의 날짜 간격을 정의합니다. JMP16좋은 아침이에요,
오늘 아침부터 JMP 스크립트에 문제가 발생했습니다. 도움이 필요합니다.
J'ai essayé de définir deux fonctions pour avoir la date de début de mois et la date d'aujourd'hui :
axe1:get_day_of_month- 이 함수는 날짜를 입력으로 받아 해당 월의 날짜를 숫자로 반환합니다.
axe1:get_dates- 이번 달의 시작일과 오늘 날짜를 검색하는 함수입니다.
그런 다음 계산할 함수는 다음과 같습니다.
//nb_total_ict 및 nb_total_fct: 수행된 총 테스트 수를 계산할 수 있습니다.
//nb_nok_ict 및 nb_nok_fct: 모든 테스트 중 nok 수를 계산할 수 있습니다.
월초부터 오늘 날짜까지 ICT 및 FCT의 NOK 비율을 계산합니다.
첨부된 내용은 내 코드 일부의 복사본입니다.
미리 감사드립니다.
감사합니다,
야스
// Fonction pour obtenir le jour du mois
axe1:get_day_of_month = Function({date},
day_of_month = Num(Format(date, "dd"));
day_of_month
);
// Fonction pour récupérer les dates
axe1:get_dates = Function({},
today_date = Format(Today(), "yyyy-mm-dd");
day_of_month = axe1:get_day_of_month(Today());
start_of_month = Format(Today() - (day_of_month - 1), "yyyy-mm-dd");
{start_of_month, today_date}
);
// Fonction pour calculer les pourcentages de NOK
axe1:calculate_nok_percentages = Function({dt},
{start_of_month, today_date} = axe1:get_dates();
// Initialisation des variables
nb_total_ict = 0;
nb_total_fct = 0;
nb_nok_ict = 0;
nb_nok_fct = 0;
// Récupération des lignes correspondant à la période spécifiée
FileRows = dt << Get Rows Where(
Num(Char(:Date)) >= Num(start_of_month) & Num(Char(:Date)) <= Num(today_date) & Contains(:File Name, "GOLDEN") == 0
);
total_rows = N Items(FileRows);
For(j = 1, j <= total_rows, j++,
If(dt:ICT_FCT[FileRows[j]] == "ICT",
nb_total_ict += dt:Nb_de_lignes[FileRows[j]];
If(dt:Result[FileRows[j]] == "NOK",
nb_nok_ict += dt:Nb_de_lignes[FileRows[j]]
)
);
If(dt:ICT_FCT[FileRows[j]] == "FCT",
nb_total_fct += dt:Nb_de_lignes[FileRows[j]];
If(dt:Result[FileRows[j]] == "NOK",
nb_nok_fct += dt:Nb_de_lignes[FileRows[j]]
)
);
);
// Calcul des pourcentages NOK
percent_nok_ict = (nb_nok_ict / nb_total_ict) * 100;
percent_nok_fct = (nb_nok_fct / nb_total_fct) * 100;
// Affichage des résultats
Window("Analyse des données") << Append(
V List Box(
Outline Box("Résultat NOK",
Border Box(
Text Box("Pourcentage de NOK ICT du " || start_of_month || " au " || today_date || " : " || Char(Round(percent_nok_ict, 2)) || "%"),
Text Box("Pourcentage de NOK FCT du " || start_of_month || " au " || today_date || " : " || Char(Round(percent_nok_fct, 2)) || "%")
)
)
)
);
);
자동화 및 스크립팅윈도우Re: 월의 시작과 오늘 날짜 사이의 날짜 간격을 정의하세요 JMP16당신이 겪고 있는 문제는 무엇입니까(문제를 쉽게 찾을 수 없기 때문에 커뮤니티의 번역이 정확하지 않을 수 있습니다)? 아마도 Date Difference() 또는 Date Increment() 를 사용하고 싶을 것입니다. 월의 첫 번째 날짜를 가져오려면 간격 이름으로 "월"을 사용하고 정렬로 "시작"을 사용합니다. 예를 들어 이번 달의 첫 번째 날짜
Date Increment(Today(), "Month", 0, "start");
JMP에는 또한 월(날짜)을 가져오는 Month()와 이러한 유형의 작업에 유용할 수 있는 더 많은 날짜/시간 함수가 있습니다.

Re: 월의 시작과 오늘 날짜 사이의 날짜 간격을 정의하세요 JMP16날짜 테이블(dt)을 기반으로 ICT 및 FCT에 대한 테이블에서 NOK 결과의 백분율을 계산하기 위해 해당 월의 시작 날짜와 오늘 날짜를 가져오는 두 가지 함수를 정의하려고 했습니다.
나는 사용했다
axe1:get_day_of_month - This function takes a date as input and returns the day of the month as a number.axe1:get_dates - This function gets the start date of the current month and today's date.axe1:calculate_nok_percentages - This function calculates the percentage of NOK results for ICT and FCT based on a date table (dt). It filters the data for rows where the file name does not contain "GOLDEN" and then calculates the percentage of NOK for ICT and FCT for the specified date range.
하지만 매번 다음과 같은 오류 메시지가 나타납니다.
JMP 경고
기호 평가가 너무 재귀적입니다(>250 레벨).<< start_of_month에 액세스하거나 평가하는 동안 라인 1에서,start_of_month
라인 1에
스택 오버플로가 감지되었습니다.최대 통화 수준 수를 초과했습니다.1행에서 실행이 종료되었습니다.
Re: 월의 시작과 오늘 날짜 사이의 날짜 간격을 정의하세요 JMP16문제는 For 루프에 있다고 생각합니다. 아마도 최적화될 수 있으며 루프를 사용할 필요조차 없습니다. 행에 대한 지식이 이미 있는 경우 데이터 테이블 첨자를 사용하여 테이블에서 원하는 값을 가져올 수 있습니다. 부분 집합 + 요약을 사용하여 계산을 수행할 수도 있습니다.
시연하는 데 사용할 수 있는 데이터(또는 모형 날짜)의 작은 예를 제공할 수 있다면 더 많은 제안을 드릴 수 있습니다. 또한 예시를 제공할 수 있다면 올바른 결과에 대한 정보를 제공해 보세요.
Re: 월의 시작과 오늘 날짜 사이의 날짜 간격을 정의하세요 JMP16두 가지 가능성이 있는데 두 번째 가능성이 있는 것 같습니다.
axe1:get_day_of_month = Function({date},
{ day_of_month },// 1: use local variables
day_of_month = Num(Format(date, "dd"));
day_of_month
);
// Fonction pour récupérer les dates
axe1:get_dates = Function({},
today_date = Format(Today(), "yyyy-mm-dd");
day_of_month = axe1:get_day_of_month(Today());
start_of_month = Format(Today() - (day_of_month - 1), "yyyy-mm-dd");
// 2: use evallist
evallist( {start_of_month, today_date} )
);
1: day_of_month는 전역적일 수 있으며 함수 간에 혼동될 수 있습니다.
2: 반환하는 목록에는 값이 아닌 변수 이름이 있으며 변수 이름은 ... 자체에 저장됩니다. 나는 그것이 재귀가 될 것이라고 생각합니다.
(멋져 보이는 코드!)
Re: 월의 시작과 오늘 날짜 사이의 날짜 간격을 정의하세요 JMP16귀하의 제안과 도움에 감사드립니다.
원래 루프에서 일부 오류를 발견했기 때문에 오늘 날짜와 월 시작 날짜를 가져오고 다른 For 루프를 사용하는 get_dates 함수를 수정했습니다. 하지만 귀하의 제안은 매우 도움이 되었습니다
그것은 get_dates 함수입니다:
axe1:get_dates = Function({},
today_date = Format(Today(), "yyyy-mm-dd");
start_of_month = Format(Date Increment(Today(), "Month", 0, "Start"), "yyyy-mm-dd");
evallist({start_of_month, today_date});
);모든 것에 다시 한번 감사드립니다!