Reputation: 441
I have column which is data type number(1,0), I decide to use switch item for this column. I set custom settings. 1 for On and 0 for off.
When I try to edit column, and use off(0) I get error - Column_name must match the values 1 and 0. When I use On value all works fine.
Upvotes: 1
Views: 4793
Reputation: 18630
Goku, in apex, the best way to learn (you said yourself you're a beginner) is to write a lot of small apps in a dev environment that only perform one thing. That way you can isolate issues and study behavior in detail. I suggest you do the same for this switch item issue to figure out what the problem is. You have not provided enough information for anyone to answer it so users are giving you their best guesses. So this is what I did. Create test table
create table so_test_with_switch (
so_test_with_switch_id number generated by default on null as identity
constraint so_test_with_switc_id_pk primary key,
name varchar2(255),
switchval number
);
Create a report and form in apex, change the form item for switchval page item (P32_SWITCHVAL) to "Switch" with custom settings: 1 for On and 0 for off. I tested and my form worked fine. The error message indicates that the value apex is getting does not match either 1 or 0 so it must get that value from somewhere else. In my case I added an after submit computation to set the value of P32_SWITCHVAL to 'Y'. Saved my changes, ran the form, clicked "Apply Changes" and I got the same error as you. It is up to you to figure out where your page item is getting the other value from. Go through your page, investigate and debug. The key to finding the solution is in your code. --Koen
Upvotes: 2