My application prints statements for customers. Naturally, I want each customer's statement to start at the top of a page. How do I make it do that?
In the Section Expert, if I check 'new page before' the first group, it wastes a page at the beginning, and if I check 'new page after' the last group, it wastes a page at the end. I don't mind so much when printing 350 statements, but when I print just one, it's pretty low class as well as wasteful.
This is the 'built in' Crystal Reports in Visual Studio.
use this on new page after
Not(OnLastRecord)
Do you have 'keeptogether' set? You should be able to do 'new page after' on the group footer and it will only go to the next page if there is a following group. Otherwise it will print the page and report footer.
You might be able to use a formula for the 'new page before' option. Something like the below would return true for pages 2+ of course, giving you the new page when needed. Just a theory. :)
PageNumber > 1
Just write down the two lines of codes and it will work properly--
rDoc.ReportDefinition.Sections["GroupHeaderSection1"].SectionFormat.EnableNewPageBefore = true;
rDoc.ReportDefinition.Sections["GroupHeaderSection1"].SectionFormat.EnableKeepTogether = true;
Thanks and Regards
Related
I'm hard stuck with this one so any advice welcome!
Ive been trying to create a flow that goes to this website https://dlv.tnl-uk-uni-guide.gcpp.io/ and scrapes the data from each table in the Subject Areas drop down list. My knowledge of HTML is sketchy at best but from what I understand it's a dynamic html table that just refreshes with new data rather than going to a new url. I can extract the subject list as a variable and in my head i think i just need to add this to a UI selector action but despite numerous attempts i've got absolutely nowhere. Anyone got any ideas as to how i could fix this or work around?
Because it is not a conventional drop-down using the "Set drop-down list value on web page" doesn't work all that well.
You can use a bit of javascript and variables for this.
Hit F12 to show developer tools, you will see there is a list of hidden items with the class class="gug-select-items gug-select-hide" you will use this in the javascript.
Then add a 'Press button on web page' function and add the 'drop-down' element, which is a <div>
Then edit the element selector and change it to text editor.
then change the selector to make use of the nth-child(0) selector but use a variable for the index.
so it looks something like #gug-overall-ranking-select > div.gug-select-items > div:nth-child(%ddIdx%)
Use the "Run JavaScript function on web page" function to get the number of options available to the drop-down. (child elements)
The returned result is text, so convert it to a number that can be used in the loop.
function ExecuteScript() { /*your code here, return something (optionally); */
var firstDDlist = document.querySelector("#gug-overall-ranking-select > div.gug-select-items.gug-select-hide");
return firstDDlist.children.length;
}
In the loop each element will be pressed and cause the table to reload.
The table data extraction can then also be done in the loop, but that this code only shows the looping through the options.
The full flow 'code' (copy this and paste it in power automate).
WebAutomation.LaunchEdge.LaunchEdge Url: $'''https://dlv.tnl-uk-uni-guide.gcpp.io/?taxonomyId=36&/#gug-university-table''' WindowState: WebAutomation.BrowserWindowState.Normal ClearCache: False ClearCookies: False WaitForPageToLoadTimeout: 60 Timeout: 60 BrowserInstance=> Browser
WebAutomation.ExecuteJavascript BrowserInstance: Browser Javascript: $'''function ExecuteScript() { /*your code here, return something (optionally); */
var firstDDlist = document.querySelector(\"#gug-overall-ranking-select > div.gug-select-items.gug-select-hide\");
return firstDDlist.children.length;
}''' Result=> numberOfItems
Text.ToNumber Text: numberOfItems Number=> itemCount
LOOP ddIdx FROM 1 TO itemCount STEP 1
WebAutomation.PressButton.PressButton BrowserInstance: Browser Control: appmask['Web Page \'h ... sity-table\'']['Div \'gug-select-selected\''] WaitForPageToLoadTimeout: 60
END
It should end up looking like this:
Flow running:
With using Power Automate Desktop (PAD), the goal is to be a low-code solution. Of course knowing HTML is a bonus and will help you on tricky webpages or problems, but not knowing much is alright usually. I'm not really comfortable going to that web page you shared but you could try the below option.
PAD has a built in function in the action pane:
'Browser automation' > 'Web data extraction' > 'Extract data from web page'
Try using that and when asked to add UI Element select the table/dropdown list to see what information you get back. If that doesn't work you might need to try out JavaScript or another method.
I am using ruby and capybara(which leverages selenium) to automate walking through a website. After navigating to a new page I verify that the new page URL is what i'm expecting. My issue comes when I walk through an order funnel that is a single page but loads different views.
Some code...
I create my session instance then have additional code opening the browser and walking to a certain point in the website that I wont include
$session = Capybara::Session.new(:selenium)
My line for checking the browser URL without search params ie: everything after '?'
if url == $session.current_url.to_s.split("?")[0]
urlCorrect = true
end
This code works fine when my URL is
https://www.homepage.com
Then I click on a link that takes me to my order funnel ... https://www.homepage.com/order#/orderpage1?option1=something&option2=somethingelse
My function still matches the expected URL. But the issue comes when I move to the second page of the order funnel :
https://www.homepage.com/order#/orderpage2?option1=something&option2=somethingelse
My capybara code to get current url still returns the URL from orderpage1. Im guessing its because there is no postback when moving from orderpage1 to orderpage2 but i dont know how to force a postback or tell capybara to re-grab the url
Any advice will be appreciated.
Thanks
Quick Edit: I forgot to mention this behavior is only in IE. Chrome and Firefox both work correctly with the exact same code
Capybara grabs the current_url by querying the browser - it doesn't cache it. The issue you're probably running into is that clicking the link to move to the next page doesn't wait for the page change to happen, so if you call current_url before the page load has happened you'll still get the original url. There are two solutions for that - 1. use capybara to look for content that doesn't appear until the new page is loaded ( have_content ), 2. use the has_current_path? method which will wait/retry for a period of time until the current_path/url match
$session.has_current_path?('expected path')
There are options if you want to match against the full url, and you can use a regex to match as well - http://www.rubydoc.info/gems/capybara/Capybara/SessionMatchers#has_current_path%3F-instance_method
Thanks to Tom Walpole for finding the bug report for this issue. This link sums up the root of the issue and provides a few workarounds if anyone else is encountering this issue.
https://github.com/angular/protractor/issues/132
Here's the item in question - specifically that little caret:
http://screencast.com/t/NMPOM9Ok58q
As you can see there are multiples of those within the same page, they all have the same class etc.
I've tried several different routes and I've not been able to successfully click on that item.
I always want to click on the last of them present on that page (the number of them are dynamic so sometimes it's the 2nd one and sometimes it's the 6th - so referring to it with a specific number doesn't work)
Thanks for the help (my tests are written in ruby, using selenium and testunit)
Here are some things I've tried and a few variations of these as well (none of which actually produce a click on that item)
#driver.find_element(:class, "dropdown-toggle")[-1].click
#driver.find_element(:css, "(//*[contains,'a.dropdown-toggle')]").click
element_present?(:css, "div.dropdown.open > a.dropdown-toggle").click
#driver.find_element(:css, "div.dropdown.open > a.dropdown-toggle").click
#driver.find_elements(:css, "caret")[-1].click
#driver.find_element(:css, "caret:last-of-type").click
#driver.find_element(:css, "div.dropdown.open > a.dropdown-toggle:last-child").click
#driver.find_element(:class, "span1").find_element(:tag_name, "a").click
^ This one actually is the only one that clicks anything - but it only clicks the first carat.
Ultimately what I'm doing with this test is adding a filter, closing the filter window, re-opening the filter window, deleting the previous filter, adding a new one and closing the window.
how about using the CSS last child selector?
#driver.find_element(:css, "div.dropdown.open > a.dropdown-toggle:last-child").click
If <div class="span1"> is unique, you can try someth like:
#driver.find_element(:class, "span1").find_element(:tag_name, "a").click
ok, so, if you need to click all links, or just someth of it, then:
#links = #driver.find_element(:class, "span1").find_elements(:tag_name, "a")
#links[0].click - for first link
#links[1].click - for second link
etc.
I want to change the dropdown message or remove it all together. I've searched for instances of --Please Select-- but I cannot find the one that controls the Custom Option dropdowns.
Searched high and low but I cannot find where this code lives in Magento, any help will be greatly appreciated!
The easiest way to change the text would be through translation. Open app/locale/en_US/Mage_Adminhtml.csv (or whichever language you have installed) and you'll see a row for "-- Please Select --" already there, change the text in the second column and clear the translation cache. This affects all instances of "-- Please Select --" throughout the admin.
To be more specific copy the file app/code/core/Mage/Adminhtml/Model/System/Config/Source/Product/Options/Type.php to an equivalently named folder in app/core/local/ and either change or delete the line that looks like this:
array('value' => '', 'label' => Mage::helper('adminhtml')->__('-- Please select --'))
I had a similar issue myself and, after searching high and low, decided to take what I knew about Magento and tackle it alone.
And here's your answer:
Open: \app\code\core\Mage\Catalog\Block\Product\View\Options\Type\Select.php
Alter the following lines:
if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN) {
$select->setName('options['.$_option->getid().']')
->addOption('', $this->__('-- Please Select --'));
}
To:
if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DROP_DOWN) {
$select->setName('options['.$_option->getid().']');
// ->addOption('', $this->__('-- Please Select --'))
}
Summary of changes: I commented out the ->addOption line with two forward slashes AND - and this is important - I moved the semi-colon from the end of that line to the end of the previous line. Reversing this change allows you to undo the changes you made.
When you plug that pup in, you'll see on the frontend your first custom option displaying as the default text.
Here's an example from my website, a product page for my Rugged Notebooks distribution company.
what is the best method using ruby/mechanize/nokogiri to go/click through all pages in case there is more than 1 page I need to access/click on? For example here Page 1 of 34 Should I click the page number or next? Or is out there any better solution?
It looks like the link ">" takes you to the next page, and it does not appear if you are on the last page. So:
page = ... # fetch the first page
loop do
# process the page
break unless link = page.link_with(:text=>'>')
page = link.click
end
You should try out scrubyt. It's described as "mechanize on steroids". It has dedicated method for clicking through pages.