BlackList implementation.

Hello. Im making a simple video rental. Now i want to implement something like “blacklist”.

I have 3 tables: customers, videos, transactions.

In customers form i made a button “Add to black list” which open another simple form with 3 edits and 2 buttons:

-CustID

-BanReason

-BanDate

Buttons: OK, Cancel.

And now, my problem and goal is to when i set banReason and banDate, then click Ok - it should change yesNoEnum “IsBanned” to true.

Need help, thanks.: )

Tell us about your form implementation. Do you have data source in the form or just some unbound fields?

I have CustTable in my dataSource in my CustForm.

I am taking about the form with three edit fields and 2 buttons.

Same thing - custTable.

Im writing code, but i dont know how to make a select-where statment:

void clicked()

{

MMA_Cust custTable;

ttsbegin;

select CustomerId, BlackListDescp, IsBlocked

from custTable where CustomerId /* selected index statment */

;

custTable.IsBlocked = false;

custTable.BlackListDescp = “”;

custTable.update();

ttsCommit;

super();

}

I dont know how to make this /* selected index statment */.

Why cannot you use the selected customer value in the select statement?

I want to use exacly that, but i dont know how. :stuck_out_tongue:

Is the custId is a bound field (table.field) or an unbound field?

Its bound field and replacement key, no allowed duplicates, main index.

BlackListDescp isn’t a property of customer, therefore it shouldn’t be in CustTable. Create a new table representing the black list and simply refer to customer account numbers.

then use that table.field in the where clause

I know it shouldn’t be, but i have task to make it in this table. Its not my fault. :frowning:

I just want to know how to get values of selected grid in my form. :slight_smile:

Get custId from the args, and implement in where condition.

The button has datasource property, you have to set custTable as datsource for your button and get the args record in the new form