Support Board
Date/Time: Tue, 15 Apr 2025 12:50:26 +0000
Post From: sc.GetStudyIDByIndex / sc.GetStudyIDByName always return 0
[2025-04-10 20:16:18] |
Richard Chinn - Posts: 33 |
The issue is: Both GetStudyIDByIndex and GetStudyIDByName return 0 instead of the actual study instance. From the current documentation (not complete) I am assuming these functions may not be fully implemented yet, but I don't know so I wanted to bring them to your attention. Here is what is happening: My control study is running on chart number 1. I am attempting to add the ATR technical study S_ID 19 to chart number 2 (actually charts 2-8). My code sets "studyNumber" via sc.AddStudyToChart (I'm adding more than one study to a chart in a loop). I pass chartNumber and studyNumber in to sc.GetStudyIndexById (expecting a return value of the study instance) and I save it. That's it, the value always comes back as 1 on chart 1, and 0 on all other charts. So To Test and see if I would get any value other than zero: I manually set the studyNumber (GetStudyIDByIndex parameter) to multiple S_ID numbers (In multiple test runs) with the same result --> 0 and I also tested using instance numbers of studies on my chart with the same result --> 0 Here is my code snippet for reference: int studyNumber = sc.AddStudyToChart(addStudy); --> This IS ADDING the study to the chart correctly LOG_DEBUG("studyNumber: " + Stringify(studyNumber)); --> Returned studyNumber as 19 (For ATR study, S_ID) -> Correct int actualStudyNumber = sc.GetStudyIDByIndex(pChartNumber, studyNumber); LOG_DEBUG("actualStudyNumber: " + Stringify(actualStudyNumber)); --> Returned actualStudyNumber as 0 -> Wrong? //--------------------------------------------------------------- // THESE ARE MY TESTS TO VERIFY WHAT THE FUNCTIONS ARE RETURNING //--------------------------------------------------------------- int testId = sc.GetStudyIDByIndex(pChartNumber, studyNumber); LOG_DEBUG("testId: " + Stringify(testId)); --> Returns testId as 0 I ran different tests: studyNumber = 1-10 (My Study Instances), studyNumber = S_ID (Study S_ID numbers) int testNameId = sc.GetStudyIDByName(pChartNumber, EnumName(pStudy).c_str(), true); LOG_DEBUG("testNameId: " + Stringify(testNameId)); --> Returns testNameId as 0 NOTES: 1. The return value is always 0, consistently on Charts 2-8 2. sc.AddStudyToChart IS returning the right S_ID numbers 3. It doesn't matter if the study being added is the first instance or the 10th, the return values (from the 2 functions) are always 0 4. IF the study is being added to chart number 1, where my control study is running as the 1st instance on the chart: - This line: int actualStudyNumber = sc.GetStudyIDByIndex(pChartNumber, studyNumber); --> Returns 1 - The line immediately following it: int testStudyId = sc.GetStudyIDByIndex(pChartNumber, studyNumber); --> Returns 0 These are the same call just being assigned to different variables so they should be the same value. - Both of these are returning the wrong values because my control study occupies instance 1 on chart 1 (minimally we should expect a value of 2 if no other studies are on the chart) and - testStudyId should be the same as actualStudyNumber. |