I have a form that contains several data blocks, all the fields are bind to the database by setting their properties to the database column name. All the items on each block are displayed on one canvas.
The items on the form contain personal data, however information like the customers phone numbers and addresses are stored on separate tables on a one to many mapping and is linked by the customer number, it takes into consideration the customer can have many phone numbers and many addresses.
The biggest problem here is when the user user is in query mode and has entered information on each block when they try to leave a block they get a message asking them 'Do You Want To Save Changes'. This happens for each block. So this message comes up several times.
What i am trying to achieve is this message should be suppressed so the user is asked this only once. I know once the user answers yes i can do_commit on each block to make changes save. However i have no control over this message and i would like to know the best way to structure an application to avoid this.
Add to trigger where you execute_query or do commit something like this.
:SYSTEM.MESSAGE_LEVEL := '25';
COMMIT;
:SYSTEM.MESSAGE_LEVEL := '0';
This suppress system messages. You did not write what trigger do you use in leaving block.
Related
Situation: We get audit emails every morning. The body of the email contains a table with various columns. The column labelled 'ID' is the unique key for each row. I have to copy the data from the ID column, format it in note++, and then paste it in a pre-filled query in SQL were I run it.
Question: Is it possible to automate this process? if so, where could I start? I would be nice if I could have something that either runs automatically or manually, reads the email, extracts the data from the column, formats it, and throws it in a query and executes.
Additional Details: The emails are always from the same distro, fire at the same time every day, and the table columns are static.
My skill Level: Beginner but resourceful and eager to learn, so please don't crucify me if I am not clear.
Yes, it is possible. You can develop a VBA macro or a COM add-in if you need to distribute your solution on multiple machines. Basically you are interested in handling the NewMailEx event of the Application class which is fired when a new message arrives in the Inbox and before client rule processing occurs. You can use the Entry ID returned in the EntryIDCollection array to call the NameSpace.GetItemFromID method and process the item. This event fires once for every received item that is processed by Microsoft Outlook. The item can be one of several different item types, for example, MailItem, MeetingItem, or SharingItem.
After retrieving the incoming item you can process it by getting property values and adding them to the SQL Db.
You may find the Walkthrough: Create your first VSTO Add-in for Outlook article helpful.
I have a question to determine if something is possible.
I have a report where the user enters in a client number into the parameter. This parameter is not loaded with available values because the number of unique client numbers is too large. After they enter a client number, they receive a list of that client's matters. Some clients have hundreds of matters.
What I want is for the user to be able to click on a matter and have it take them to a second report, the go to feature, that shows them additional details about that one matter they clicked on. Is that something that's possible? I don't want the user to have to input a matter from a list of values on that second go-to report, so maybe it's possible to have a cascading parameter in the second one that's hidden from the user but auto-populates based on what they clicked?
I'm still trying to get cascading parameters to even work for me, but I'm not even sure where to begin researching what I want to do here. Any guidance on what to look for would he super helpful, or let me know if it's not possible.
Thanks!
Rough guidelines:
create a report that accepts the matter number as a parameter
on the textbox/cell in the original report that the users will be clicking, right click on it and select properties, set action to go to report, and then select the new report and pass the value of matter id to the new report parameter
Users are PASTING data into a form in DATASHEET mode, so many records are being entered at the same time. For a specific field called ID, I need to validate the ID against another table. In the sense that the IDs they enter should be already available in another table. Drop down box, selection is not possible.
I also need to return the values that are not VALID
What kind of SQL statment or VBA or validation rule should I use?
"In the sense that the IDs they enter should be already available in another table" - you need an event to trigger the check, so perhaps have them enter into a datasheet on a form rather than a back end table then you can use the various on-changed events, search online for them. In that event simply run a one-to-one query. To return "return the values that are not VALID" you simply need an unmatched query, again, search for info, it's widely documented.
I have two tables, HELP_PROBLEMS and HELP_SOLUTIONS.
HELP_PROBLEMS has a number of different fields, including PROBLEM_ID, SOLUTION_ID, PROBLEM_DESC etc.
HELP_SOLUTIONS has just SOLUTION_ID and SOLUTION_DESC.
I'm trying to build form that when you view the edit form of a problem, you can add the solution in a form below it.
In my mind, when I hit the button Add Solution (submit), it creates the new row in HELP_SOLUTIONS, and adds the SOLUTION_ID to the current row in HELP_PROBLEMS. (and update a few other things but trying to keep this as basic as possible).
Is this at all possible? I thought the 'master form' might work but I couldn't seem to sort it out as planned.
Thanks,
C.
You can create a pl/sql block that inserts a value in two different tables.
create a page process and select pl/sql
then try something like
begin
--insert into help_problems
--insert into help_solutions
end;
I've a trigger that detects a change on a field PHONE_EXT and POSTs an EVENT. I would like to post the Phone_ID with the event in order to use this ID in the client. Is this possible? How?
CREATE TRIGGER tr2 FOR employee
ACTIVE AFTER UPDATE POSITION 0
AS
BEGIN
IF (new.PHONE_EXT <> old.PHONE_EXT) THEN
POST_EVENT 'phone_ext_changed'; <-- I would like to pass a string parameter with record ID
END
AFAIK, you cannot pass parameters, but you can get what you want with one of this ideas:
If in your client you're interested in events over specific records, you can append the ID of the changing record and post that event. The clients register the events in which are interested using the specific ID's of interest. See example 1.
if your front-end are interested in all changes but you want to know which particular records changed, you can "flag" the records as "recently changed" (using another field on the same record, or a detail table, for example). Upon client notification and action it reverts or clears the flag. This approach may be powered, for example, using auxiliary tables to track missing records from specific clients, it depends on your needs.
Example 1
begin
if (new.phone_ext <> old.phone_ext) then
post_event 'phone_ext_changed_'||new.ID;
end
Example 2
begin
if (new.phone_ext <> old.phone_ext) then
begin
new.recent_ext_change = 1;
/* or maybe */
new.last_ext_change = cast('now' as DateTime);
/* or maybe */
insert into changed_phone_ext values (gen_id(some_generator, 1), New.ID, 'now');
/* finally, post the event */
post_event 'phone_ext_changed_';
end
end
I'm using both with success in different applications/situations.
You can use it as follows:
Set a context variable in the trigger and place the desired information in it.
Ex.:
Create trigger evento_ai0 for evento
active after insert position 0
AS
BEGIN
Post_Event 'Evento_inserido';
"Creating the context variavble"
rdb$set_context('USER_SESSION', 'REGISTRO' , 'Registro inserido: '||new.eve_id);
END
To capture the saved information use:
Select rdb$get_context('USER_SESSION', 'REGISTRO') from rdb$database;
This is not possible. The event is a name only, if you add ids or other qualifiers, it simply becomes a different event because it has a different name. When subscribing to events, you can only subscribe by name, you can't use wildcards, and it is not possible to include parameters.
Events are for simple and cheap notification, and Firebird can even coalesce multiple 'posts' of the same event into a single notification to a client, so parameters or values are not supported.
The basic idea is that a client subscribe to events, and then determines what changed and what it needs to react to. You can 'help' the client by - for example - populating a support table that is cheap to query.
Also consider reading the article "The Power of Firebird Events", it is a bit old, but a lot of it still applies as Firebird events haven't changed much.