Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Auto-generate of ID's in Gridview

Author  Topic 

taj
Starting Member

39 Posts

Posted - 2013-06-26 : 02:11:06
Hi all,

Urgent Requirement related to gridview.....


Test Name Doctor Name Doctor Date Sample Id Sample Date Select

Blood Test AAA 26/06/2013 0 26/06/2013
Urine Test BBB 26/06/2013 0 26/06/2013
Lipid Profile CCC 26/06/2013 0 26/06/2013
Sugar Test DDD 26/06/2013 0 26/06/2013
Fast Blood EEE 26/06/2013 0 26/06/2013
Blood Urea FFF 26/06/2013 0 26/06/2013
Haemoglobin GGG 26/06/2013 0 26/06/2013

Above are few lab tests of a patient which must be done before and after having food/meals and the Patient had paid the bill for all above mentioned lab tests.

In the above gridview the last column is select column ie;checkbox column.

For First visit of patient: BEFORE MEALS
The lab assistant will collect the sample and select the tests,which can be done by the collected samples for BEFORE MEALS,for those many tests i need to generate a unique sample id Eg:1(ONE),and the remaining tests Sample id should be zero.

For Second Visit of patient:AFTER MEALS
The gridview should display only the remaining tests for which samples need to be collected,Now lab assistant will collect the sample and select the tests, which can be done by the collected samples for AFTER MEALS,for those many tests i need to generate a unique sample id Eg:2(TWO) and i should not show the previously generated sample id's ie:1(one).

All these auto-generating of sample id's Should reflect in gridview.

How to fix this?

SOLUTIONS WITH CODE or SMALL EXAMPLES WILL BE APPRECIATED.

Thanks You
taj

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-26 : 02:25:24
Sorry your posted data doesnt have enough details

Things missing

1. there's no field currently shown which indicated which of tests are before meal and which are after. There should be ideally a field for that
2. There's no field which indicates patient info ie for which patient above tests were scheduled. Without this info there's no way in grid to just show tests for a particular patient

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

taj
Starting Member

39 Posts

Posted - 2013-06-26 : 02:53:45
sir,

I have button "Generate Sample ID" control in the gridview page, once i clicked the button, sample id value should be generated only for the checked rows(for example if i check first 2 rows in grid then i click the button for those first 2 records only sample id should be Generated as 1 because my last generated sample id is 0) for the next time when i reopen the same page the previously checked rows should not be displayed in the grid whose sample id is 1, and when i check the remaining unchecked rows of grid this time the previously generated number should be incremented by 1 and the number 2 should be generated as a sample Id.

Thank you
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-26 : 02:56:28
You still didnt answer the questions asked. My question was not at all regarding the sample id but was more on identifying the test before and after meal and also on the patient info

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

taj
Starting Member

39 Posts

Posted - 2013-06-26 : 03:10:58
Sir,

Actually the thing is different its totally depends on the lab assistance they will decide which test to be performed before meals and after meals, their is no specific column indicating test type (before and after meals)....

Thank you
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-26 : 03:13:16
ok...do you've a table where you store the tests selected?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

taj
Starting Member

39 Posts

Posted - 2013-06-26 : 03:22:27
Sir,

This is my table "Patient_Lab_Tests" where my selected tests gets saved with sample id.

i have one more table "Param_Config" where my latest sample id gets saved every time.

thank you
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-26 : 04:04:51
then isnt it a matter of

SELECT MAX(sampleid) + 1 FROM Param_Config

to get next sample id value?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

taj
Starting Member

39 Posts

Posted - 2013-06-26 : 07:14:47
Ya, but i want only checked items row should have a same value, how to do this please let me know
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-26 : 09:23:29
that part has to be code in front end application as that where you handle checked event

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -