Good day
I have a template setup on fastreports, and what I am trying to do is that when the template is printed, it should print page 1 and page 2 but when it is emailed, it should only email page 1
my coding is as follow:
procedure Page2OnBeforePrint(Sender: TfrxComponent);
begin
if (<Document_Information."Method">) = 'Emailed' then
Page2.Visible := false
else
Page2.Visible := true;
end;
But when emailing the template, it still emails page 2, any advise?
Related
I'm trying to automate my SAP GUI until the end of the page and I got the code below from this site https://www.appsloveworld.com/vba/200/144/algorithm-for-finding-end-of-a-list-sap-gui
I only changed the text after findById but I get this error at the line which changes verticalScrollbar.Position:
object doesn't support this property or method
Any ideas on how to solve that?
Do While Not blank
If session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").Text = "" _
Then blank = True
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").verticalScrollbar.Position = i
i = i + 1
Loop
I need to use multiples Report.Print() in a code, but business central only prints the last requested print.
Using a dialog.confirm(), a page.runmodal() or a message() between the prints works, but I need the code to run automatically without user input.
Any ideas?
Ex.: Not working, only last one prints
codeunit 90101 Test
{
trigger OnRun()
var
salesInvoice: Record "Sales Invoice Header";
RecRef: RecordRef;
begin
salesInvoice.setfilter("No.", '103021');
RecRef.GetTable(salesInvoice);
Report.Print(1306, '', '', RecRef);
salesInvoice.Reset();
salesInvoice.setfilter("No.", '103022'); //only this one prints
RecRef.GetTable(salesInvoice);
Report.Print(1306, '', '', RecRef);
end;
}
Ex2.: working, prints both
codeunit 90101 Test
{
trigger OnRun()
var
salesInvoice: Record "Sales Invoice Header";
RecRef: RecordRef;
begin
salesInvoice.setfilter("No.", '103021');
RecRef.GetTable(salesInvoice);
Report.Print(1306, '', '', RecRef);
salesInvoice.Reset();
salesInvoice.setfilter("No.", '103022');
RecRef.GetTable(salesInvoice);
if Dialog.Confirm('hello') then;
Report.Print(1306, '', '', RecRef);
end;
}
I'm having the same issue.
I was just as confused as I kept thinking "but how does report selection work then?" but realized it always opens the request page.
I'm considering these 2 options:
Save as pdf and store it to a blob and print it using a .net service running on the application server. See this article for printing pdf's.
Create a non-recurring job queue entry to print each report.
This is worked out quite well for me:
...
CreatePrintingJob(Report::"Warehouse Shipment", WarehouseShipmentHeader.RecordId);
...
procedure CreatePrintingJob(_ReportID: Integer; _RecordToPrint: RecordId)
begin
CreatePrintingJob(_ReportID, '', _RecordToPrint);
end;
procedure CreatePrintingJob(_ReportID: Integer; _ReportParameters: Text; _RecordToPrint: RecordId)
var
jobQueueEntry: Record "Job Queue Entry";
begin
jobQueueEntry.Init();
jobQueueEntry."Object Type to Run" := jobQueueEntry."Object Type to Run"::Report;
jobQueueEntry."Object ID to Run" := _ReportID;
jobQueueEntry."Record ID to Process" := _RecordToPrint;
jobQueueEntry."Starting Time" := 000000T;
jobQueueEntry."Maximum No. of Attempts to Run" := 3;
jobQueueEntry."Report Output Type" := jobQueueEntry."Report Output Type"::Print;
jobQueueEntry.Insert(true);
jobQueueEntry.SetReportParameters(_ReportParameters);
jobQueueEntry.ScheduleTask();
end;
I'm trying to walk through a hitlist of pages found by Mechanize. Upon a search, which is working just fine, I get a hitlist with 10 records per page. A bottom navigation system takes me to the record count > 10. Display 10 per page. So 53 records = 6 "group pages" as I'm calling them.
What I want to do is use the top search results page to do the following:
Grab the html behind every record on this list. I can do that through an iteration.
Follow through the '[Next]' link at the bottom and repeat both 1 and 2 until there is no more 2. Essentially this will get every record.
I'm having an issue with moving off the first page into the second page. I'm grabbing the html behind the first 10 records, but then the system bonks on me. Not sure why. I thought I was iterating through the group pages, but it isn't advancing past the first group page.
counter = 1
puts "Counter: #{counter}"
while agent.page.links_with(:text => '[Next]').count == 1
page = agent.page.link_with(:text => '[Next]').click
puts "Counter/Next: #{counter} / #{agent.page.links_with(:text => '[Next]').count}"
agent.page.links_with(text: '[complete profile]').each do |link|
a = link.click # link.click goes to each company page
r = a.body.to_s
r = r.gsub(/^\s+\n/, "")
# enter company into db
class Company < ActiveRecord::Base
end
company = Company.new
company.cdate = DateTime.now
company.status = 'new'
company.requestID = req_id
company.html = r
company.save
end
counter += 1
end
Any insight appreciated. I know I'm close.
Cheers
Solution: move the click method behind page:
page = agent.click(page.link_with(:text => "[Next]"))
I have an Active Server Page, which displays Booking of the current Day. I setted the PageSize to two, so my display is displaying just 2 bookings per side, if there are more Records. So actually i have 8 bookings in my Recordset, so my ASP creates 4 Pages.
I wrote the following function:
Function getNext10(num)
getNext10 = CurrPage + 1
End Function
Finally i call that function in a meta tag, to automatically change the pages:
<meta http-equiv="refresh" content="10;URL=paging.asp?PageNo=<% Response.Write(getNext10(CurrPage))%>" />
It is working like charm.
But i have just one more Problem. If i do that like this the PageNo is increment endless.
My PageCount is 4.
So what i need in my function is a logic which checks whether the PageCount has been reached or not. If yes then he should start from the first page again, if not then increment until pagecount has reached.
Can someone help me with that? Thanks!!
EDIT:
I Wrote that function:
Function getNext10(num)
getNext10 = num
if getNext10 < i then // In `i`, i have my pagecount (4), which i got from Recordset.PageCount
// I checked it with Response.Write()
getNext10 = CurrPage + 1
End if
End Function
If i use i the if clause is not working, i dont know why. Its only working if i use directly a number.
If you know the page number will always be 4, then you can make a check for that.
Function getNext10(num)
if (num < i) then
CurrPage = num + 1
else
CurrPage = 1 'Reset the page count
end if
'Updating the variable used to call the page iterator
getNext10 = CurrPage
End Function
If you do not always know the page number then you will need to calculate the number of pages somehow to check against.
I try to achieve the following layout with Wordpress 3.2.1:
---> ID 4 (Record 2, 3rd Attempt)
--> ID 3 (Record 2, 2nd Attempt)
-> ID 2 (Record 2, 1st Attempt)
--> ID 5 (Record 1, 2nd Attempt)
-> ID 1 (Record 1, 1st Attempt)
Every line represents a page and on the Backend the page hierarchy looks like that:
-> ID 1
--> ID 5
-> ID 2
--> ID 3
---> ID 4
I'm sorry I prepared a nice illustration but I'm not yet allowed to post images. So, to explain it a bit further: I try to build a list of records and as soon as one of the records gets broken, it will shift to the right and on top of it the newest record attempt appears.
Ok, so first question: How do I have to set up query_posts to recursively get all children? The following code only returns page 3 but not 4:
<?php query_posts(array('post_parent' => 2, 'post_type' => 'page')); ?>
And second question: Does anyone know a better/simpler/sexier (Wordpress) solution for what I try to achieve?
try
$child_pages = get_pages('child_of=2');
you can look it up in the WP Codex here: http://codex.wordpress.org/Function_Reference/get_pages