Persist window screen for dynamic ID - xul

I wanted to persist window position. But the case is windows id are dynamic.
Here is the detail scenario..
dynamic_id will be one of "id1", "id2" ... "id5"// these are fixed
window.openDialog("chrome://something/content/test.xul, name, dynamic_id)
and my test.xul is
<window persist="screenX screenY" ..... >/<window>
Now how could I achieve persistance of window.
I tried adding
window.id = dynamic_id, But it doesn't works..
Or If there is a way to do something like below:
<window id = "dynamic_id" persist= ..../></window>
Thanks in advance!!

that is becuease the url is always the same, and this is the "id" that mozilla use to remember "the persisting things" in its database of "persisting things".
Do this:
openDialog("chrome://something/content/test.xul?id=" + dinamic_id, name )
then in your text.xul, you have to obtain the id, do this:
id = location.search.match( /id=([^&]+)/ ) && RegExp.$1

Related

Is it possible to select more statements in SQLite?

I have the following code :
SELECT Description FROM KeysDB WHERE Count='0 (Blocked)' OR ErrorCode='0xC004C060' AND Description LIKE '%Win%'
It works normally until I change it.
SELECT Description FROM KeysDB WHERE Count='0 (Blocked)' OR ErrorCode='0xC004C003' OR ErrorCode='0xC004C060' AND Description LIKE '%Win%'
I want to select all Windows product key with Count = 0 (Blocked) or ErrorCode = 0xC004C060 or ErrorCode = 0xC004C003
and / or have different operator precedence. That means their binding strength is differently.
You can use parentheses to make it how you like. Not sure if this is how you intended it but you get the picture:
SELECT Description
FROM KeysDB
WHERE
(
Count='0 (Blocked)' OR ErrorCode='0xC004C003' OR ErrorCode='0xC004C060'
)
AND Description LIKE '%Win%'

Like Clause over an 'Element' - ORACLE APEX

I encounter some problems that i don't understand with APEX.... Well, let's be specific.
I ve got a select element retrieving a top 50 of most liked url (P11_URL). This is populate by a table view, TOp_Domains.
I create an element called "Context" that have to print all text containing the URL selected by the user from the element select. Those Texts come from another table, let's say "twitter_post".
I create a dynamic action (show only) with this sql/statement:
Select TXT, NB_RT, RANK
from myschema.twitter_post
where TXT like '%:P11_URL%'
group by TXT, NB_RT, RANK
.... and it doesn't work... I think APEX don't like like clause... But i don't know how to do. Let's keep in min an url could have been shared by multiple Tweets, that's why this element "context" is important for me.
I tried to bypass the problem by building a State (in french Statique) and a dynamic action that will refresh the state but it doesn't work neither... bouhououououou
TriX
Right click on the 'P11_URL' and create DA. Event :change, Item:P11_URL. As the true action of the DA, select 'Set Value'. Write your query in the sql stmt area. In the page items to submit, select 'P11_URL' . In the 'Affected Items': select 'Context'.
Query should be :
Select TXT, NB_RT, RANK
from myschema.twitter_post
where TXT like '%' || :P11_URL || '%'
group by TXT, NB_RT, RANK
So
Thanks to #Madona... Their example made me realised my mistake. I wrote the answer here for futher help if somebody encouter the same porblem.
A list select element get as arguments a display value (the one you want to be shown in your screen.... if you want so....^^ ) and a return value (in order, I think to linked dynamic actions). So to solved my problem i had to shape my sql statement as:
select hashtags d, hastags r
from my table
order by 1
[let s say that now in Apex it s an object called P1_HASHTAGS]
First step problem solving.
In fact, the ranking as second value, as i put into my sql statement was making some mitsakens into my 'Where like' clause search... well... Newbie am i!
Second step was to correctly formate the sql statement receiving the datas from my select lov (P1_HASHTAGS) into my interactive report. As shown here:
Select Id, hashtags
from my table
where txt like '%'||:P1_HASHTAGS||'%'
And it works!
Thank you Madona your example helped me figure my mistakes!

How can I stop executing code after getting a result?

I have a textbox named "Search" and code that filters a customer out by name. I also want to display the whole table if the textbox is empty but don't know how to do it.
NOTE : I am using Microsoft Access.
Here is my code :
SELECT * FROM Customers
WHERE Forms.[Form1].[Text4] = Forms.[Form1].[Text4] AND FirstName=Forms.[Form1].[Text4];
Thank you for any help.
You need validate if text is empty or filter to another rules, this can be something like this:
SELECT * FROM Customers WHERE Forms.[Form1].[Text4] IS NULL OR FirstName = Forms.[Form1].[Text4];

Count rows of data and display in view ASP.net MVC

All i'm trying to do is count how many bookings have requested wheelchair access not sure with the best way....
using (var context = new TalyllynContext())
{
var count = context.Bookings.SqlQuery(" SELECT * FROM dbo.Booking Where Wheelchair_Access = 'true' ").Count();
}
ViewBag.Count = count;
This is what i want to happen in the SQL, but not sure how to make the view bag Count display the variable or is there a much better solution
In the view it can be anything as long as it shows the count value !!
using (var context = new TalyllynContext())
{
ViewBag.Count = context.Bookings.SqlQuery(" SELECT * FROM dbo.Booking Where Wheelchair_Access = 'true' ").Count();
}
return View()
If you are using razor do something like this.
<p>#ViewBag.Count</p>
That will display the value in the view if you use the code you showed.
Did you tried moving the count variable before the using statement, so that it is accessible outside the using as well.
Yes moving the view back worked thank you life save i also changed it like this as an example
ViewBag.Count = db.Bookings.SqlQuery(" SELECT * FROM dbo.Booking Where Gift_Aid = 'true' ").Count();

Liferay DynamicQuery - xPath and Array comparison

My final goal is I want to get plid and portletId that can be display my article(or entry with any type if it is possible).
I have sql query that return me any portlet availble for display my article.
But when I have to use dynamicQuery to get the same results, I get problem with xPath and array comparison, please help!
SELECT * FROM portletpreferences pr
WHERE pr.preferences != '<portlet-preferences />' AND pr.ownerid = 0 AND pr.portletid ilike '%_INSTANCE_%' AND pr.plid IN(
SELECT layout.plid FROM layout
WHERE layout.type_ = 'portlet' AND layout.groupid = 19 AND layout.hidden_ is false)
AND pr.portletpreferencesid IN (
SELECT pr.portletpreferencesid FROM portletpreferences pr
WHERE 'true' = ANY(xpath('//preference[name="anyAssetType"]/value/text()', XMLPARSE(DOCUMENT pr.preferences))::text[])
OR (SELECT (array(SELECT id_ FROM journalstructure))::text[]) && xpath('//preference[name="classTypeIds"]/value/text()', XMLPARSE(DOCUMENT pr.preferences))::text[] )
If you are bent upon using this same query, then use this query directly with Custom-SQL in liferay by creating custom-finders instead of using DynamicQuery. That would give you a lot of flexibility in using any type of SQL query directly.
I don't think this query can be converted to DynamicQuery, but if you do manage to convert it then please do post it here :-)
DynamicQuery is very powerful, see e.g. my answer how to find layouts with specific JournalArticles. I think your requirement is similar to this one:
Liferay: How to find all Layouts with the specific JournalArticle in AssetPublisher portlets?