Printing reports with APEX Office Print on a master detail page - master-detail

I have created a new blank page with: interactive grid, items and button print with dynamic action for APEX Office Print plugin with SQL Code and it is printing my reports the way I wanted.
But, I want to do the same exactly thing inside my master detail page. When I enter my detail form I want to have a button "print" with the same action for printing that report. I have done the same thing (like on the "blank page") on my master detail form (added new button print with dynamic action and SQL Code and connected it with my primary key) but it is not working, it is printing blank reports.
What am I missing here?

Add another item with the same value (P_ID) which gets submitted. Then add new button print with dynamic action and SQL Code and connected it with that new item you have created.

Related

Java FX database problem when adding new datas

I have a database problem. I want to create a simple Java FXML application which could help to my friend to search the protein/potassium content of the foods, because of kidney disease.
I have 4 class variables: name, protein, potassium, and id for the database (to identify the variables in the database).
I use Java DB - derby.
My application has 2 pane: 1. „home screen” has a textfield, where you have to type the name of the food you looking for, and if you click to the „search” button it will search the appropriate data from the database and show it in a table on the next pane. (the searching isn't working yet – you can type anything in the textfield what you want and then click to "Search", but no results showed yet in the table).
On the next page you can see the table, and at the bottom, you can add new data. I did a test to make sure the database works correctly, so the second pane I wrote a test Name, test Protein content, test Potassium content, and then click to the „add” button. Then the table shows just the potassium value, and puts this value in the first column instead of the „potassium column”. By the way, the db works but just stores the last value in the first column. I think I have a mistake somewhere in the setTableData method, but I run out of the ideas.
Here is my link to my files: https://github.com/Capkit/FirstProjects
I would be very grateful if somebody could help me!

Autopopulate a field in a form based on what user is logged in

I've created an access database using access 2007 for one of the teams I work with and I'm fairly new to access so would like some help. The database is being used to log jobs for engineers so I have a login system where a user selects their name from a drop down and enters their password, and depending on their access levels they get directed to their own user menus etc. Now what I would like is once the user has logged in they will click on the job sheet button will then direct them to a list of jobs raised from here they click on new and then a pop of the Job Sheet where they can enter details from the call pops up what i want is in this job sheet for their name to auto-populate in the field labelled user, how do I get the user who has logged in their name to just auto populate in the field once they have accessed it.
You might want to check out the "OnLoad" property of the form. Go to the properties section of the job sheet and click on its "on load" event. Select VBA code. Type the following:-
me.fieldname = [Forms]![FirstFormWhereLoginDropdownPresent].DropDownName.Value
Hope this helps

MS Access keep ID field in subform filled with ID from parent form

Everytime I jump to where I can enter e new record, the ID field from the parent is empty and so the connection is lost. I am looking for a workaround.
My Setup
I have a parent form that deals with two 1:n relationships
(school-class --> pupils, school-class --> tests).
For the first relationship I used the wizard. Everything works find. For the second I show the connected tests in an unbound list. Under the list is a button opening the form for entering a new record (test) for the class I came from (parent form). So I filter the sub-form via VBA so that only the tests of the current class are shown. That works perfectly fine, too.
When moving through the tests already connected with the class the correct ID (of the class filtered) is the value of the corresponding input field. But when I come to the new new record state (all fields empty), then the connection to the parent breaks and the user has to manually enter the ID of the parent (school-class).
My Question
Is my setup correct?
Is there a better way to create a subform that offers to (only) enter a new record connected to the parent data? (Maybe without the ID input field in the subform and passing of forcing the value via VBA?)
Thank you for your time!
You can use Default Value to set the classid of Tests form but be sure the parent form is open in background or behind the pop up.
Under Property Sheet/Data tab of Tests form's classid control, enter in Default Value cell:
=Forms!parentformname!classid
Alternatively, in VBA in the Tests form's OnOpen Event:
Me.classid.DefaultValue = Forms!parentformname!classid
You can then choose to hide (Visible - No) this classid control so users do not modify it. It's always advised to never allow users control of primary and foreign keys.

Sencha touch mainView push/pop strange behaviour after pushing 5 forms

I'm building account system using sencha touch (architect) and now I have an issue where the code executed but the this.getMainView().pop(); NOT and the view states on current one !
my views:
Login scrn--> cstmrs list--> cstmr details--> rceipt--> checks
When I get to receipt view (without checks) the code executed and auto returned to customer's details view.
But soon I click to add a check to the receipt (only displaying the form without any code) the check view injected to mainview after that I click back button to return to receipt window, but now when I click save button the receipt is saved and the data arrives server side ok, but the big problem the this.getMainView().pop(); doesn't work or doesn't executed !!
Is there any wrong with my code? it works without displaying the 'checks' form !
Nothing in firebug/chrome debugger
I use this code to show forms:
var mainView=this.getMainView();
mainView.push({xtype: "frmChcks",title:'new check'});
And this code for getting back:
this.getMainView().pop();
Thank you in advice
Ahhhh it was because I used a hidden field called 'id', don't use 'id' for you components :-)

Display Alert box through the trigger - salesforce

Is it possible to display an alert message (not error message) through a trigger? I have written a trigger that checks for duplicate accounts in the system. The trigger at the moment gives an error message to the user telling that there is a duplicate account. But, if the user changes the value of a field "Is record near to duplicate?" to YES, the trigger allows the user to save the record.
But, I want to display the error message in an alert pop up box like "Account with this Name exists,are you sure you want to continue" and then user clicks Yes and the record gets created. Any thoughts on how I can do this. My code is below:
for(Account account: System.Trigger.New)
{
if(accountMap.containsKey(account.Physical_Street__c)==accountMap2.containsKey(account.Phone))
if(accountMap.containsKey(account.Physical_Street__c)==accountMap3.containsKey(account.Name))
if(account.Is_record_near_to_duplicate__c.equals('No'))
{
account.addError('Account with this Name,Street and Phone Number already exists. If you still wish to create the agency change the value of field "Is Record Near To Duplicate" to YES');
}
}
If you really need an alert box then you could create a custom javascript button that uses the ajax toolkit to replace the standard save button.
However, as Baxter said you are getting pretty far from standard salesforce look and feel. I would recommend instead to add an error on the checkbox field instead of the object so it is clear to the user what they need to select.
if(account.Is_record_near_to_duplicate__c.equals('No'))
{
account.Is_record_near_to_duplicate__c.addError('Agency with this Name, Physical Street and Phone Number already exists. If you still wish to create the agency change the value of field "Is Record Near To Duplicate" to YES');
}
Unless you write a custom visualforce page that processes the error message and then displays it as a popup there's no way to do this.
If you wanted the alert to modify the data you may look at using the ajax api to set the Is_record_near_to_duplicate__c field to 'Yes' but either way you're getting pretty far from the standard functionality and interface with this.
It is not straight forward to implement a pop-up alert for a trigger error, and pop-ups went out-of-fashion a long time ago. If you are going through the hassle, you might as well implement a custom soultion on a VF page.
Throw a custom exception(for dupe accounts) from the trigger, and catch it in your controller. When you catch this exception, you can dynamically displayed section on the page which asks the user to confirm his/her action. When the user confirms the action, the page will do the rest.
Hope this makes sense!
Anup

Resources