How to use BUILTIN.PERIOD - netsuite

I want to query the last seven day's worth of invoices. This is my best attempt:
SELECT T.*
FROM Transaction AS T
WHERE T.type IN('CustInvc') AND trandate IN(BUILTIN.PERIOD('SDLW', 'START', 'ALL', '>'))
I've read the documentation, but I'm missing something. I believe SDLW stands for SAME_DAY_LAST_WEEK. I even tried (but couldn't) sign up for an account to view this answer. I've clipped the relevant documentation below as HTML.
body {
font-family: 'Oracle Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
<tr>
<td style="padding:3.6px;width:17.5%;">
<p style="font-size:1em !important;margin:0px;">
<code>PERIOD</code>
</p>
</td>
<td style="padding:3.6px;width:23.4%;">
<p style="font-size:1em !important;margin:0px;">Returns the contents of the IN predicate for a relative date range as a subselection</p>
</td>
<td style="padding:3.6px;width:36.5%;">
<ul>
<li>
<p style="font-size:1em !important;margin:0px;">Range ID</p>
<p style="font-size:1em !important;margin:0px;">This parameter accepts the same property values listed in the query.RelativeDateRange enum in the N/query module (for example, <code>'LFY'</code> to represent a range starting or ending last fiscal
year).
</p>
</li>
<li>
<p style="font-size:1em !important;margin:0px;">Range type</p>
<p style="font-size:1em !important;margin:0px;">This parameter accepts the following values (including the single quotation marks):</p>
<ul>
<li>
<p style="font-size:1em !important;margin:0px;">
<code>'START'</code>
</p>
</li>
<li>
<p style="font-size:1em !important;margin:0px;">
<code>'END'</code>
</p>
</li>
</ul>
</li>
<li>
<p style="font-size:1em !important;margin:0px;">Adjustment</p>
<p style="font-size:1em !important;margin:0px;">This parameter accepts the following values (including the single quotation marks):</p>
<ul>
<li>
<p style="font-size:1em !important;margin:0px;">
<code>'NOT_LAST'</code>
</p>
</li>
<li>
<p style="font-size:1em !important;margin:0px;">
<code>'ALL'</code>
</p>
</li>
</ul>
</li>
<li>
<p style="font-size:1em !important;margin:0px;">Operator</p>
<p style="font-size:1em !important;margin:0px;">This parameter accepts the following values (including the single quotation marks):</p>
<ul>
<li>
<p style="font-size:1em !important;margin:0px;">
<code>'BETWEEN'</code>
</p>
</li>
<li>
<p style="font-size:1em !important;margin:0px;">
<code>'NOT BETWEEN'</code>
</p>
</li>
<li>
<p style="font-size:1em !important;margin:0px;">
<code>'<'</code>
</p>
</li>
<li>
<p style="font-size:1em !important;margin:0px;">
<code>'<='</code>
</p>
</li>
<li>
<p style="font-size:1em !important;margin:0px;">
<code>'>'</code>
</p>
</li>
<li>
<p style="font-size:1em !important;margin:0px;">
<code>'>='</code>
</p>
</li>
</ul>
</li>
</ul>
</td>
<td style="padding:3.6px;width:22.4%;">
<pre width="370.7472" class="line-numbers precomplete" tabindex="0"> <code class="language-sql hljs">BUILTIN.PERIOD('LFY', '<span class="hljs-operator"><span class="hljs-keyword">END</span><span class="hljs-string">', '</span>NOT_LAST<span class="hljs-string">', '</span>><span class="hljs-string">')
</span></span></code>
</pre>
<pre width="376.0704" class="line-numbers precomplete" tabindex="0"> <code class="language-sql hljs">BUILTIN.PERIOD('LFY', '<span class="hljs-operator"><span class="hljs-keyword">START</span><span class="hljs-string">', '</span><span class="hljs-keyword">ALL</span><span class="hljs-string">', '</span><span class="hljs-keyword">BETWEEN</span><span class="hljs-string">')
</span></span></code>
</pre>
</td>
</tr>

Use RELATIVE_RANGES together with the > operator
SELECT * FROM transaction
WHERE type IN('CustInvc')
AND trandate > (BUILTIN.RELATIVE_RANGES('SDLW', 'START'))
Or if you want to have the same day last week included use the >= operator.
SELECT * FROM transaction
WHERE type IN('CustInvc')
AND trandate >= (BUILTIN.RELATIVE_RANGES('SDLW', 'START'))

Related

how to get to the next element of list inside for loop in django template?

i have a list like
lst = [
['img1','img2','img3','img4','img5'],
['img6','img7','img8','img9']
]
and a template like
<div class="row"> -- 1st row
<div class="col-lg-3" data-aos="fade-up"> --col-lg-3
<a href="{{img1}}"> --img1
<img src="{{img1}}"> -- img1
</a>
</div>
<div class="col-lg-6" data-aos="fade-up" data-aos-delay="100"> --col-lg-6
<a href="{{img2}}"> --img2
<img src="{{img2}}"> --img2
</a>
</div>
<div class="col-lg-3" data-aos="fade-up" data-aos-delay="200"> --col-lg-3
<a href="{{img}}"> --img3
<img src="{{img}}"> --img3
</a>
</div>
</div>
<div class="row"> ---2nd row
<div class="col-lg-8" data-aos="fade-up" data-aos-delay="100"> --col-lg-8
<a href="{{img2}}"> --img2
<img src="{{img2}}"> --img2
</a>
</div>
<div class="col-lg-4" data-aos="fade-up" data-aos-delay="200"> --col-lg-4
<a href="{{img}}"> --img3
<img src="{{img}}"> --img3
</a>
</div>
</div>
please note few things:
every col-lg size is of different size
every and tag of a column contain 1 img
i want to iterate over the whole template but in a different way
eg: i can do this in python where i can iterator over list and assign the value as well
for data in lst:
it = iter(data)
print (next(it)) ---where print will be replaced with img tag
print (next(it))
print (next(it))
print (next(it))
print (next(it))
but how can i do this in django template
Django's for-in template loop builds the DOM defined between the template tag loop for each item in data.
That being said, you could adapt your solution like so:
<div class="row align-items-stretch">
{% for img in data %}
<div class="col-6 col-md-6 col-lg-3" data-aos="fade-up">
<a href="{{ data.img }}" class="d-block photo-item" data-fancybox="gallery">
<img src="{{ data.img.url }}" alt="Image" class="img-fluid">
<div class="photo-text-more">
<span class="icon icon-camera"></span>
</div>
</a>
</div>
{% endfor %}
</div>
If data contains three items/images, the output will be something like:
<div class="row align-items-stretch">
# 1st iteration
<div class="col-6 col-md-6 col-lg-3" data-aos="fade-up">
<a href="href_according_to_data" class="d-block photo-item" data-fancybox="gallery">
<img src="link" alt="Image" class="img-fluid">
<div class="photo-text-more">
<span class="icon icon-camera"></span>
</div>
</a>
</div>
# 2nd iteration
<div class="col-6 col-md-6 col-lg-3" data-aos="fade-up">
<a href="href_according_to_data" class="d-block photo-item" data-fancybox="gallery">
<img src="link" alt="Image" class="img-fluid">
<div class="photo-text-more">
<span class="icon icon-camera"></span>
</div>
</a>
</div>
# 3rd iteration
<div class="col-6 col-md-6 col-lg-3" data-aos="fade-up">
<a href="href_according_to_data" class="d-block photo-item" data-fancybox="gallery">
<img src="link" alt="Image" class="img-fluid">
<div class="photo-text-more">
<span class="icon icon-camera"></span>
</div>
</a>
</div>
</div>

BeautifulSoup .find() capturing too much text (how do I narrow it down?)

wondering how to target the "Switch" text on the below html:
<div class="product_title">
<a href="/game/pc/into-the-breach" class="hover_none">
<h1>Into the Breach</h1>
</a>
<span class="platform">
<a href="/game/pc">
PC
</a>
</span>
</div>
<div class="product_data">
<ul class="summary_details">
<li class="summary_detail publisher" >
<span class="label">Publisher:</span>
<span class="data">
<a href="/company/subset-games" >
Subset Games
</a>
</span>
</li>
<li class="summary_detail release_data">
<span class="label">Release Date:</span>
<span class="data" >Feb 27, 2018</span>
</li>
<li class="summary_detail product_platforms">
<span class="label">Also On:</span>
<span class="data">
Switch </span>
</li>
</ul>
</div>
so far I am capturing the "Also On:" text as well (with a lot of spaces) with this code:
self.playable_on_systems_label.setText(self.html_soup.find("span", class_='platform').text.strip() + ', ' + self.html_soup.find("li", class_='summary_detail product_platforms').text.strip())
how do I capture (in this case) only the "Switch" text?
FYI - for the first half of the statement (capturing the "PC") text works fine just not the "also on" text
Thanks in advance,
Your query is getting the entire span element with class="summary_detail product_platforms", which is going to include all the text starting from "Also On:" until "Switch." Try something like .find('a', href=re.compile("^.+switch.+$")) or alternately (using CSS) .select("a[href*=switch]") (solution from here)
you can use BeautifulSoup select() function to navigate the the "Switch" text, check this code!!!
rom bs4 import BeautifulSoup
html = '''<div class="product_title">
<a class="hover_none" href="/game/pc/into-the-breach">
<h1>Into the Breach</h1>
</a>
<span class="platform">
<a href="/game/pc">
PC
</a>
</span>
</div>
<div class="product_data">
<ul class="summary_details">
<li class="summary_detail publisher">
<span class="label">Publisher:</span>
<span class="data">
<a href="/company/subset-games">
Subset Games
</a>
</span>
</li>
<li class="summary_detail release_data">
<span class="label">Release Date:</span>
<span class="data">Feb 27, 2018</span>
</li>
<li class="summary_detail product_platforms">
<span class="label">Also On:</span>
<span class="data">
<a class="hover_none" href="/game/switch/into-the-breach">Switch</a> </span>
</li>
</ul>
</div>'''
soup = BeautifulSoup(html, 'html.parser')
text = soup.select('.summary_detail.product_platforms .hover_none')[0].text.strip()
print(text)
Output:
Switch

Meteor.JS - Yogiben Favourites - How Can I Show Title?

I'm building a small app within meteor, using the yogiben favourites package to allow users to favourite select items in a collection.
Currently the below code only shows the ID of the favourite/post, rather than the corresponding title.
How can I show the title?
<template name="favoritesSidebar">
<div class="template-favorites-sidebar">
{{#if myFavorites.count}}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{{_ "favorites"}}</h3>
</div>
<div class="panel-body">
<ul>
{{#each myFavorites collection="Posts"}}
<li>
<a>{{_id}}</a>
</li>
<li>
<a>{{_title}}</a>
</li>
<li>
<a>{{Post._title}}</a>
</li>
{{/each}}
</ul>
</div>
</div>
{{/if}}
</div>
</template>

Get active value from a carousel to an URL

I am working with ASP.net MVC 5, I have created a bootstrap carousel/slideshow with 4 images, I want to get the id of the active slide on this carousel. Then, when an user is clicking on an submit button, I can redirect him to another page recording the active slide id in the URL.
<form method="post">
<div id="mycarousel" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#mycarousel" data-slide-to="0" class=""></li>
<li data-target="#mycarousel" data-slide-to="1"></li>
<li data-target="#mycarousel" data-slide-to="2"></li>
<li data-target="#mycarousel" data-slide-to="3"></li>
</ol>
<a class="carousel-buttonleft" href="#mycarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-buttonright" href="#mycarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
<div class="carousel-inner" role="listbox" style="height:300px">
<div class="item active" align="center">
<div align="center" class="carousel-image"><img src="../images/saumon.png" alt="saumon1" /></div>
<div class="carousel-caption">
<p>NORMAL SKIN</p>
</div>
</a>
</div>
<div class="item ">
<div align="center" class="carousel-image">
<img src="../images/saumon.png" alt="saumon1" />
</div>
<div class="carousel-caption">
<p>SILVER SKIN</p>
</div>
</div>
<div class="item " align="center">
<div align="center" class="carousel-image"><img src="../images/saumon.png" alt="saumon1" /></div>
<div class="carousel-caption">
<p>DEEP SKIN</p>
</div>
</div>
<div class="item " align="center">
<div align="center" class="carousel-image"><img src="../images/saumon.png" alt="saumon1" /></div>
<div class="carousel-caption">
<p>WITH SKIN</p>
</div>
</div>
</div>
</div>
Thanks.
sorry i'm currently using my phone. You must select by className.
In css :
.carousel-inner .item .active
In jQuery :
$('.carousel-inner .item .active')
then... .attr('id') and for the value .val() or .text()
In C#, I found this topic to show you how to iterate inside your page controls depending a specific className target :
StackOverflow

How do I select a JS tab in watir-webdriver?

I have a webpage which has tab list, the HTML looks like this for this piece:
<div id="content">
<div class="col span-6">
<div class="section first no-border">
<h2>New Search</h2>
<ul class="tabs clear">
<li id="simple-li" class="current">
<a onclick="switch_search_type('SimpleSearch');; return false;" href="#">Simple</a>
</li>
<li id="structured-li">
<a onclick="redirect_to_search('/search/structured_searches/new'); return false;" href="#">Wizard</a>
</li>
<li id="advanced-li" class="">
</li>
<li id="custom-li" class="">
<a onclick="switch_search_type('ComplexQuerySearch');; return false;" href="#">Custom</a>
</li>
</ul>
<div class="tabbed-panel">
I want to select the "Custom" item in this tab list. I tried multiple things but have failed, some of the things I tried:
browser.li(:id, "custom-li").click
browser.select_list(:id, "custom-li").set("Custom")
browser.link(:xpath, "id('custom-li')/x:a").click
browser.select_list(:id => 'custom-li').select "Custom"
I am new to watir-webdriver. Any feedback and help is greatly appreciated.
Try this:
browser.a(:text => "Custom").click

Resources