Topic: Table Grid

Hi Everyone,

i created a stock OUT form.

I have a two forms (form1) will ADD Only a product one at a time (No saving record yet) once the user knows how many quantity will be out.

it will display only in my tablegrid.(form2).

the CONFIRMED button (this button will save the records from my tablegrid). is this possible in MDV?  i just want to save all the records added one time.

while learning MVD i can display the data but i have to use save record then display into my tablegrid.

hope you can guide me.

Post's attachments

Attachment icon tableGrid.PNG 93.63 kb, 63 downloads since 2022-05-22 

-lemodizon

Re: Table Grid

here is my project file

Post's attachments

Attachment icon IMS_052222 - draft.7z 1.39 mb, 138 downloads since 2022-05-22 

-lemodizon

3 (edited by joshuA 2022-05-23 00:24:06)

Re: Table Grid

Hi lemodizon,


This is not a complete solution, but hopefully it provides some ideas to work with.


Most tablegrids are attached to a table in the database, so in my example, I added a TMP table to hold the changes "to be committed".  This gives you a table full of items that need to be updated, so you'll have to fill-in the SQL to make that happen.


While it is possible to add items manually to a tablegrid, I believe that defeats their purpose.  Someone correct me if I am wrong about that.

-joshuA

Post's attachments

Attachment icon IMS_052222-2.zip 1.45 mb, 127 downloads since 2022-05-23 

"Energy and persistence conquer all things."

Re: Table Grid

joshuA wrote:

Hi lemodizon,


This is not a complete solution, but hopefully it provides some ideas to work with.


Most tablegrids are attached to a table in the database, so in my example, I added a TMP table to hold the changes "to be committed".  This gives you a table full of items that need to be updated, so you'll have to fill-in the SQL to make that happen.


While it is possible to add items manually to a tablegrid, I believe that defeats their purpose.  Someone correct me if I am wrong about that.

-joshuA


Hi joshua,

Thanks for the response.

TMP table is a temporary table once i clicked the button "confirmed"  will it transfers or create a records going to my "StockOUT" table is this possible in MVD?  so that StouckOUT table will stored all the item that is been pulled out.

Edit button

i tried to create a script code it doesn't work.

// i created a var that will store all the text fields
var
    Hold_flds_QttyOut: string;
    Hold_flds_Remarks: string;
    Hold_flds_Area: string;
    Hold_flds_NewQtty: string;

///////////////////////////////////////////////////////////////////////////////////////////////////


procedure frmStockOUT_Add_OnShow (Sender: TObject; Action: string);

begin
      if action = 'NewRecord' then

    if frmStockOUT_Add.txtProdID.Text <> '' then
    begin
        frmStockOUT_Add.cboProdList.dbItemID := strToInt(frmStockOUT_Add.txtProdID.Text);
        frmStockOUT_Add_cboProdList_OnCloseUp(Sender);
    end;

    begin


    If Action = 'ShowRecord' then
    Begin
          frmStockOUT_Add.txtQttyOut.Text:=('SELECT QttyOut FROM Temp_StockOUT WHERE id_products= '+frmStockOUT_Add.txtProdID.Text.sqlValue+ ' '); /// i'm not sure here i don't know if this is right.
    End;

end;

end;

thanks for helping me out.

-lemodizon

Re: Table Grid

Hi Lemondizon,
Can't you just add a 'status' flag to your 'stockout' table ('confirmed', 'to be confirmed' - and anything else you might want)?
Any entries you make on the 'frmstockout_add' form can be created with a default status of 'to be confirmed'
Then it's simply a case of a batch update of the status when required.
It would also give you the option to filter by 'status' which would probably be useful.
Derek.

6 (edited by lemodizon 2022-05-23 13:58:50)

Re: Table Grid

derek wrote:

Hi Lemondizon,
Can't you just add a 'status' flag to your 'stockout' table ('confirmed', 'to be confirmed' - and anything else you might want)?
Any entries you make on the 'frmstockout_add' form can be created with a default status of 'to be confirmed'
Then it's simply a case of a batch update of the status when required.
It would also give you the option to filter by 'status' which would probably be useful.
Derek.


Hi derek,

thanks for your suggestion. I will revised my form.

here is the updated file. i don't know if  I got your suggestion derek right... i added combobox i'm looking for optional button the only available is checkbox.

Do I still need the temp table or just stockOut table will do?

Post's attachments

Attachment icon IMS_052322 - draft.zip 1.45 mb, 128 downloads since 2022-05-23 

-lemodizon

Re: Table Grid

Hi,
If you use a 'status' indicator, then there is no need for a temporary table.  Not saying one is better than the other, it's all about giving you choices.
If you use a status indicator, there are a couple of options to consider (see the attachment).
Option 1 in the attachment - simply click on the 'status' cell in frmstockout to change the cell value from 'to be confirmed' to 'confirmed' (but if you decide to have other statuses as well, clicking on the 'status' cell will toggle through each of the various statuses in turn).
Option 2 in the attachment - you can use the 'status' filter (optionally) to filter records by status and then use the 'change to status' combobox (combobox2) to select the status you want to change the records to (giving you the option to change things back if you get something wrong).
Again, no right or wrong way, it's all about what suits your application best.
Derek.

Post's attachments

Attachment icon ims options.zip 728.55 kb, 168 downloads since 2022-05-23 

Re: Table Grid

derek wrote:

Hi,
If you use a 'status' indicator, then there is no need for a temporary table.  Not saying one is better than the other, it's all about giving you choices.
If you use a status indicator, there are a couple of options to consider (see the attachment).
Option 1 in the attachment - simply click on the 'status' cell in frmstockout to change the cell value from 'to be confirmed' to 'confirmed' (but if you decide to have other statuses as well, clicking on the 'status' cell will toggle through each of the various statuses in turn).
Option 2 in the attachment - you can use the 'status' filter (optionally) to filter records by status and then use the 'change to status' combobox (combobox2) to select the status you want to change the records to (giving you the option to change things back if you get something wrong).
Again, no right or wrong way, it's all about what suits your application best.
Derek.


Hi All,derek

I got your point.

Thank you very much..

I updated my file since i'm still studying SQL I didn't putted any script code in my tablegrid. I saved all the data in my stockout table so i can use the edit button.

I chose option1 but i didn't put any script code in the table. just set the setting what records it will display.

Questions:

1. How to check in the tablegrid if the product is in the list already
So that my record will not duplicate and the  user will  go edit button. ( I tried this but using sql  checking in the database if it has duplicate).

2. in my tablegrid "Expdate" how can i set into date only format? ( i already set in the property noting happens)

3.How do you calcute in the tablegrid every item will will deduct based on the OUT item and display the balance and will removed in my table if the status is "Confirmed"  once I clicked the processd button.
Once it is done it will update my table products(master list) the quantity and balance  field. ( i tried this but in the same form)

Thank you everyone for guiding me and helping me out .

Post's attachments

Attachment icon questions.JPG 83.49 kb, 61 downloads since 2022-05-24 

-lemodizon

Re: Table Grid

Hi Everyone,

here is my updated design in my simple inventory.

Thank you in advance.

Post's attachments

Attachment icon IMS_052422 - No Scipt code in cell.7z 1.39 mb, 181 downloads since 2022-05-24 

-lemodizon

Re: Table Grid

Nicely done lemodizon.

Thanks for sharing too.
-joshuA

"Energy and persistence conquer all things."

Re: Table Grid

joshuA wrote:

Nicely done lemodizon.

Thanks for sharing too.
-joshuA


Hi joshuA,

Thank you, I'm a newbie in MVD need more practice. while reading the book "hands-on exercises for my visual database training"  when i read the database normalization i checked my tables still need to revised.

hoping i can finish my simple inventory and make another to be familiarize MVD, SQL and etc.

-lemodizon