DataGridView use with LINQ query (MCTS 70-505 Ch 6 Lesson 6 page 321 Exercise 2 "LINQ to SQL")
Option Strict Off
Imports System.Data.Linq
Imports System.Data.Linq.Mapping
<Table(Name:="Customers")> _
Public Class Customer
Dim db As New DataContext("Data Source = .\sqlexpress; Initial Catalog=Northwind; Integrated Security = true")
Dim customers As Table(Of Customer)
Private _customerID As String
<Column(IsPrimarykey:=True, storage:="_customerID")> _
Public Property CustomerID() As String
Get
Return _customerID
End Get
Set(value As String)
_customerID = value
End Set
End Property
Private _ContactName As String
<Column(Storage:="_ContactName")> _
Public Property ContactName() As String
Get
Return _ContactName
End Get
Set(value As String)
_ContactName = value
End Set
End Property
Private _CompanyName As String
<Column(Storage:="_CompanyName")> _
Public Overloads Property CompanyName() As String ' does not appear. Its a member of control base class. Shadows does not help, though it should
Get ' because the name of the column in the db happens to be the same as this property of the Control class. Overloads no good either
Return _CompanyName
End Get
Set(value As String)
_CompanyName = value
End Set
End Property
Private _Country As String
<Column(Storage:="_Country")> _
Public Property Country As String
Get
Return _Country
End Get
Set(value As String)
_Country = value
End Set
End Property
Private Sub Customer_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
' get a typed table on which to run queries
customers = db.GetTable(Of Customer)()
' query for a list of countries
Dim countriesquery As Object = From cust In customers Select cust.Country Distinct
For Each cust As Object In countriesquery ' option strict ON disallows late binding so it must be OFF (see line 1)
countryComboBox.Items.Add(cust.ToString)
Next
countryComboBox.SelectedIndex = 0
End Sub
Private Sub countryComboBox_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles countryComboBox.SelectedIndexChanged
Dim query As Object = From cust As Customer In customers _
Where cust.Country = countryComboBox.SelectedItem.ToString _
Select cust
resultsGrid.DataSource = query
End Sub
This code works as intended up to a point. It displays the countries in the comboBox as intended. Selecting a country then populates the DGV object "resultsgrid" with the customer items. Problem is that the CompanyName column (and therefore
the CompanyName values) are ABSENT from the grid. Clearly the "Resultsgrid.Datasource = query" statement is not working correctly.
You can workaround the fault by replacing this statement with manually adding columns to the resultsgrid and then iterating over the query with a for each loop, adding a row on each iteration. So the query is capturing all the data, including CompanyName.
But it begs the question: why is the CompanyName (among all the cust items) consistently missing from the resultsgrid when the datasource property statement is used? What is so special about CompanyName?
<
Column(Storage:="_CompanyName")>
PublicOverloadsPropertyCompanyName()
AsString'
doesn't appear in DGV. It's a member of control base class. Shadows doesn't help, though it should
Get'
because the name of the column in the db happens to be the same as this property of the Control class. Overloads no good either
Return_CompanyName
EndGet
Set(value
AsString)
_CompanyName = value
EndSet
EndProperty
Howard
Similar Messages
-
How to use "with clause query" in DBadapter
Hi all,
I need to implement a "with clause" query in oracle soa 11g bpel. When i put the query in db adapter in pure sql, the schema is not getting generated properly. Can any one suggest a solution to my problem.
Regards,
KaushikPure SQL won't work because it is expecting the first word in the SQL to be SELECT (or INSERT,UPDATE,DELETE).
If your query is WITH ... SELECT ...
try this:
delete everything before SELECT. Copy and paste the generated XSD to another window. The SQL test may fail, but that will just mean that it couldn't fill in the types of the columns in the SELECT ... FROM list. You can always do that yourself by hand editing the XSD (including in the wizard before you hit next). Then put back the WITH ... clause before the remaining SELECT .... If the XSD gets overwritten, copy the version you saved in the other window and paste it over top. Then hit next and the runtime should still work.
Keep in mind that SQL is very complex and hard to fully parse in the UI. However the minimum information the DbAdapter needs is quite limited; basically just the name and number of columns that are coming back. The XSD is meant to be editable in the wizard if the SQL is too complex.
Thanks
Steve -
How to use a jdbc query result to redirect to a variable html page
uh, my problem is that i'm making a servlet which should redirect to a variable html page based on jdbc query (I'm really sorry if this is not the correct forum to post it, but since it's jdbc i thought it was).
Anyway, the problem is that when a string say, "mystring" is equal to the value in a column, say "column1" of the database then page should redirect to "mystring.html".
Is this possible, if so then how?
and if not then is there any other way to solve my problem?
please, help!!
thanks in advance.uh, since i've already asked man, please gimme an answer if you know, it'll be appreciated.
OK, HERE'RE THE DETAILS:(as you requested them)
i have an html page where there's a textfield say "t1", the value of that text field is sent to the servlet which compares the value of the field with the value in Database, say "db1" in column say "column1".
if there's a value in the column matching the value inputted in the textfield, then i need the servlet to redirect to an html page of the same name as inputted in the textfield. Hope that helps you understand.....
thanks in advance....... -
Please help how to use WITH query in UPDATE
Hi Experts,
Please help me.
Thanks.Not sure about your required output. But try using WITH clause query inside SET clause of UPDATE statement.
UPDATE SALES_REVENUE SR
SET
(SR.TODAY_REV,
SR.TODAY_MARGIN,
SR.TODAY_UNIT
) =
(WITH result_sum_temp
AS(
SELECT SALE_ID, IN_TEAM, 1 SALE_FLAG, loc, seg,
SUM(REV * rate) AS sum_rev,
SUM(MARGIN * rate) AS sum_mar,
SUM(UNIT) AS SUM_UNIT
FROM SALES
WHERE (IGNORED IS NULL OR IGNORED <> 'Y')
AND SALE_SPOT = 7
AND SALE_ID = 375
AND SALE_MODEL = 'D'
AND IN_TEAM IS NOT NULL AND loc IS NOT NULL
GROUP BY SALE_ID, IN_TEAM, loc, seg
UNION ALL
SELECT SALE_ID, OUT_TEAM, 2 SALE_FLAG, loc, seg,
SUM(REV * rate) AS sum_rev,
SUM(MARGIN * rate) AS sum_mar,
SUM(UNIT) AS SUM_UNIT
FROM SALES
WHERE (IGNORED IS NULL OR IGNORED <> 'Y')
AND SALE_SPOT = 2
AND SALE_ID = 375
AND SALE_MODEL = 'D'
AND OUT_TEAM IS NOT NULL AND loc IS NOT NULL
GROUP BY SALE_ID, OUT_TEAM, loc, seg)
(SELECT t.sum_rev, t.sum_mar, t.sum_unit
FROM result_sum_temp t
WHERE SR.SALE_ID = t.SALE_ID
AND SR.team_id = t.team_id
AND SR.SALE_FLAG = t.SALE_FLAG
AND SR.SEG = t.seg
AND SR.loc = t.loc
AND t.SALE_ID = 255)
WHERE SR.SALE_SPOT = 890
AND SR.SALE_ID = 255
AND (SR.SALE_ID, SR.team_id, SR.sale_flag, SR.SEGMENT, SR.LOB) IN
(SELECT SALE_ID,
team_id,
sale_flag,
seg,
loc
FROM result_sum_temp)); -
I have had a mixed opinion for SQLCE support in windows phone 8/8.1. Is their still support for a local SQLCE or other database in windows phone 8.1? (A lot of different blog articles created their own handlers it appears and one used
an visual studio app called SQLmetal) I am hoping to at least figure out the libraries to use for Linq to SQL in windows phone 8.1 in order to access a local Database. I only need to retrieve data from a simple Database with one -
two tables and one of the tables has three fields.
I wish to access the local DB from a dll file even if I have to use Linq to SQL. The reason for this is to store data for a simple game while the app is running. However, I may need to send data to the database and would like to separate that
from the main application if possible. The only other question is: how do I add local database support to a dll file in windows phone 8.1? (This is my main objective but I need to know my database options first)
Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering
- Yoda. Blog - http://www.computerprofessions.co.nrWindows Phone Silverlight 8.1 apps can still use LINQ to SQL (System.Data.Linq) see:
http://msdn.microsoft.com/en-us/library/windows/apps/hh202860(v=vs.105).aspx
For Windows Phone 8.1 [runtime] app you would need to use an external library like
SQLite
There is a jumpstart training talk on using SQLite in Windows Phone 8.1 apps here:
http://channel9.msdn.com/Series/Building-Apps-for-Windows-Phone-8-1/19
I'm not sure what you mean by: "...access the local DB from a dll file..." Do you mean you want the library used to access the database to be portable across
platforms?
Eric Fleck, Windows Store and Windows Phone Developer Support. If you would like to provide feedback or suggestions for future improvements to the Windows Phone SDK please go to http://wpdev.uservoice.com/ where you can post your suggestions and/or cast
your votes for existing suggestions.
I saw the first link and I think I have already been through some of that tutorial on channel 9 already.
I'm not sure what you mean by: "...access the local DB from a dll file..." Do you mean you want the library used to access the database to be portable across platforms?
This would be a yes. I need use it to submit an application to the store (I wish to have the data and business logic in the dll file while having the GUI separate). I am currently using the portable dll but if you think using another dll type would help
I will try that. I am a VB.NET programmer and so I can see where some programmers get their worries about SQLCE (It seems a lot of VB and VB.NET programmers like it from my time helping on the VB.NET forums second to SQL Server only).
Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering
- Yoda. Blog - http://www.computerprofessions.co.nr
Nevermind, I changed the dll type to "Silverlight" and I can use the System.Data.Linq reference at least.
Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to
suffering - Yoda. Blog - http://www.computerprofessions.co.nr -
LINQ to SQL - UPDATE Foreign Key
Hi,
I'm doing a project with LINQ to SQL. I'm mapping the database in code.
I have 2 tables: Cargo(CodCargo PK, Cargo)
Utilizador(CodUtilizador PK, Utilizador, CodCargo FK.
Cargo:
1 - Client
2 - Provider
3 - Administrator
Utilizador:
1 - User1 - 2
2 - User2 - 3
Code in Class Utilizador:
private EntityRef<Cargo> _Cargo = new EntityRef<Cargo>();
[Association(IsForeignKey = true, Storage = "_Cargo", ThisKey = "CodCargo")]
public Cargo Cargo
get { return this._Cargo.Entity; }
set
Cargo oldCargo = _Cargo.Entity;
Cargo newCargo = value;
if (newCargo != oldCargo)
_Cargo.Entity = null;
if (oldCargo != null)
oldCargo.Utilizador.Remove(this);
_Cargo.Entity = newCargo;
if (newCargo != null)
newCargo.Utilizador.Add(this);
The problem is when I change for example in User1 this: User1.Cargo.Cargo = "Client"; Table "Cargo" change to this:
1 - Client
2 - Client
3 - Administrator
It shouldn't change, only the CodCargo on Utilizador should change.
How can I solve this without change Cargo , only updating the CodCargo on Utilizador if the field exists or create a new Cargo if don't.
Best regards,
ADAE.Hello,
>>//Is is possible to do this:newUser.Cargo.Cargo = "Client"
This is not changed the foreign key constraint, it only performs what you see: change the
2 – Provider to 1 – Client, this is not controlled by Entity Framework, it is a rule of database. It is called foreign key constraint:
https://technet.microsoft.com/en-us/library/ms175464%28v=sql.105%29.aspx?f=255&MSPPError=-2147217396, since the Entity Framework is an ORM framework, it will follow this rule.
My suggestion is that you could do what I provide, to set it foreign key property.
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How can I use a single query panel with two view criteria?
Hi all,
I have a requirement to allow users to change the "display mode" on a search results tree table for an advanced search page. What this will do is change the structure of how the data is laid out. In one case the tree table is 3 levels deep, in the other case it's only 2 with different data being at the root node.
What I've done so far:
1) I exposed the data relationship for these two ways of viewing the data in the application module's data model.
2) I created a view criteria in the two view objects that are at the root of the relationships, where (for simplicity sake) I'm only comparing a single field.
This is in one view object:
<ViewCriteria
Name="PartsVOCriteria"
ViewObjectName="gov.nasa.jpl.ocio.qars.model.views.PartsVO"
Conjunction="AND">
<Properties>... </Properties>
<ViewCriteriaRow
Name="vcrow23"
UpperColumns="1">
<ViewCriteriaItem
Name="PartDiscrepantItemsWithIRVO"
ViewAttribute="PartDiscrepantItemsWithIRVO"
Operator="EXISTS"
Conjunction="AND"
IsNestedCriteria="true"
Required="Optional">
<ViewCriteria
Name="PartDiscrepantItemsWithIRVONestedCriteria"
ViewObjectName="gov.nasa.jpl.ocio.qars.model.views.PartDiscrepantItemsWithIRVO"
Conjunction="AND">
<ViewCriteriaRow
Name="vcrow26"
UpperColumns="1">
<ViewCriteriaItem
Name="InspectionRecordNumber"
ViewAttribute="InspectionRecordNumber"
Operator="="
Conjunction="AND"
Value=""
Required="Optional"/>
</ViewCriteriaRow>
</ViewCriteria>
</ViewCriteriaItem>
</ViewCriteriaRow>
</ViewCriteria>
and this is in the other view object:
<ViewCriteria
Name="IRSearchCriteria"
ViewObjectName="gov.nasa.jpl.ocio.qars.model.views.InspectionRecordVO"
Conjunction="AND">
<Properties>... </Properties>
<ViewCriteriaRow
Name="vcrow7"
UpperColumns="1">
<ViewCriteriaItem
Name="InspectionRecordNumber"
ViewAttribute="InspectionRecordNumber"
Operator="="
Conjunction="AND"
Required="Optional"/>
</ViewCriteriaRow>
</ViewCriteria>
3) I had a query panel and tree table auto-generated by dragging the data control for ONE of the view object data relationship that's exposed in the app module. Then I created a second query panel and tree table the same way but using the data control for the other. I'm hiding one of the query panels permanently and toggling the visibility of the tree tables based on the display mode the user chooses. Both tables have separate bindings and iterators.
This is a portion of the page definition:
<executables>
<variableIterator id="variables"/>
<searchRegion Criteria="IRSearchCriteria"
Customizer="oracle.jbo.uicli.binding.JUSearchBindingCustomizer"
Binds="InspectionRecordVOIterator"
id="IRSearchCriteriaQuery"/>
<iterator Binds="InspectionRecordVO" RangeSize="25"
DataControl="QARS_AppModuleDataControl"
id="InspectionRecordVOIterator" ChangeEventPolicy="ppr"/>
<iterator Binds="Root.QARS_AppModule.PartsVO1"
DataControl="QarsMasterAppModuleDataControl" RangeSize="25"
id="PartsVO1Iterator"/>
<searchRegion Criteria="PartsVOCriteria"
Customizer="oracle.jbo.uicli.binding.JUSearchBindingCustomizer"
Binds="PartsVO1Iterator" id="PartsVOCriteriaQuery"/>
</executables>
4) I've created a custom queryListener to delegate the query event.
This is in my advanced search jsp page:
<af:query id="qryId1" headerText="Search" disclosed="true"
value="#{bindings.IRSearchCriteriaQuery.queryDescriptor}"
model="#{bindings.IRSearchCriteriaQuery.queryModel}"
queryListener="#{pageFlowScope.SearchBean.doSearch}"
queryOperationListener="#{bindings.IRSearchCriteriaQuery.processQueryOperation}"
resultComponentId="::resId2" maxColumns="1"
displayMode="compact" type="stretch"/>
This is in my backing bean:
public void doSearch(QueryEvent queryEvent) {
String bindingName = flag
? "#{bindings.IRSearchCriteriaQuery.processQuery}"
: "#{bindings.PartsVOCriteriaQuery.processQuery}";
invokeMethodExpression(bindingName, queryEvent);
private void invokeMethodExpression(String expr, QueryEvent queryEvent) {
FacesContext fctx = FacesContext.getCurrentInstance();
ELContext elContext = fctx.getELContext();
ExpressionFactory eFactory = fctx.getApplication().getExpressionFactory();
MethodExpression mexpr =
eFactory.createMethodExpression(elContext, expr, Object.class, new Class[] { QueryEvent.class });
mexpr.invoke(elContext, new Object[] { queryEvent });
When no inspection record number (the only search field so far) is supplied in the query panel, then it behaves correctly. Namely, the tree tables shows all search results. However, when an inspection record number is supplied the tree table that was created with the query panel in use (remember there are two query panels, one of them is hidden) shows a single result (this is correct) while the other tree table (the one with the hidden query panel that isn't in use) shows all results (this is NOT correct).
Is what I'm trying to accomplish even doable? If so, what am I missing?
I'm using JDeveloper 11.1.1.7
Thanks,
BillI ended up keeping one query panel permanently visible and the other permanently hidden. When performing a search using the table that has the hidden query panel, I seed the query descriptor for the hidden query panel using the visible query panel's query descriptor and then delegate the request:
public void doSearch(QueryEvent queryEvent) {
String bindingName = null;
if(isIrTableRendered()) {
bindingName = "#{bindings.IRSearchCriteriaQuery.processQuery}";
} else {
seedPartsQueryDescriptor();
bindingName = "#{bindings.PartsVOCriteriaQuery.processQuery}";
queryEvent = new QueryEvent(partsQuery, partsQuery.getValue());
invokeMethodExpression(bindingName, queryEvent);
private void seedPartsQueryDescriptor() {
ConjunctionCriterion criterion = irQuery.getValue().getConjunctionCriterion();
for(Criterion criteria : criterion.getCriterionList()) {
AttributeCriterion attributeCriteria = (AttributeCriterion)criteria;
List values = attributeCriteria.getValues();
String qualifiedName = attributeCriteria.getAttribute().getName();
int indexOfDot = qualifiedName.lastIndexOf(".");
String name = indexOfDot < 0
? qualifiedName
: qualifiedName.substring(indexOfDot + 1);
ConjunctionCriterion partsCriterion =
partsQuery.getValue().getConjunctionCriterion();
for (Criterion partsCriteria : partsCriterion.getCriterionList()) {
AttributeCriterion partsAttributeCriteria =
(AttributeCriterion) partsCriteria;
String partsQualifiedName =
partsAttributeCriteria.getAttribute().getName();
if (partsQualifiedName.endsWith(name)) {
partsAttributeCriteria.setOperator(attributeCriteria.getOperator());
List partsValues = partsAttributeCriteria.getValues();
partsValues.clear();
for (int i = 0, count = values.size(); i < count; i++) {
partsValues.set(i, values.get(i));
private void invokeMethodExpression(String expr, QueryEvent queryEvent) {
FacesContext facesContext = FacesContext.getCurrentInstance();
ELContext elContext = facesContext.getELContext();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
MethodExpression methodExpression =
expressionFactory.createMethodExpression(elContext, expr, Object.class, new Class[] { QueryEvent.class });
methodExpression.invoke(elContext, new Object[] { queryEvent });
Then when the advanced/basic button is pressed for the visible query panel, I programmatically set the same mode for the hidden query panel:
public void handleQueryModeChange(QueryOperationEvent queryOperationEvent) {
if(queryOperationEvent.getOperation() == QueryOperationEvent.Operation.MODE_CHANGE) {
QueryMode queryMode = (QueryMode) irQuery.getValue().getUIHints().get(QueryDescriptor.UIHINT_MODE);
QueryDescriptor queryDescriptor = partsQuery.getValue();
queryDescriptor.changeMode(queryMode);
AdfFacesContext.getCurrentInstance().addPartialTarget(partsQuery); -
How to persist data in the object n memory after fetching it once from database and use it with linq
Hi,
I have some data from the database around 8 to 10 records .
These records are interrelated and I need to show cascade drop down.
I want to get the records from the database using c#.
And then based on certain events on the page want to use linq over the same data without having to get the data from the data base again.
i.e
ProductName
Product Plan
Product type
Monthly
Annually
pordA
Gold
Individual
1
5
pordA
Gold
Spouse
2
6
pordA
Silver
Individual
3
7
pordA
Silver
Spouse
4
8
Prod B
Platinum
Individual
5
9
Prod B
Platinum
Spouse
6
10
Prod B
Gold
Individual
1
5
Prod B
Gold
Spouse
2
6
pordA
Silver
Individual
3
7
pordA
Silver
Spouse
4
8
pordA
Platinum
Individual
5
9
Now on page load I want product name in drop down.
Based on the productName selected i want to show Product Plan in another drop down and based on prduct plan want to show prduct type in drop down and then the annual and monthly in drop down.
I want to get all the records of prod A and then using linq to object load the drop downs instead of running query to database.
How can I keep the records available across the function calls.
Regards
VinodThis is mostly a ASP.NET question. You get better answers if you post it in ASP.NET forum.
This is my answer:
Session is not a suitable choice, since each user will have a duplicate of the data. Cache is a better option.
You can put something in Cache option and retrieve it from Cache similar to using Session. This is the manual method of caching and management of the cache content is on yourself.
public List<Product> GetAll()
List<Product> products = null;
if (Cache["Products"] == null)
DataSet data = RetrieveProducts();
products = ConvertProductsDataSetToObject(data);
Cache.Insert("Products", products, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero);
else
products = (List<Product>)Cache["Products"];
return products;
When putting something in the cache, you should set its expire time. But one thing that is more important over this is to clear the cache when your data is changed in the data store (e.g. database).
public void UpdateProduct()
// update product in the database
// clear the cahce, so that the next request for Products, receives a fresh copy of the data
Cache["TestItem"] = null;
Other than using cache manually, there are also some helper funcationalities that manage cache automatically for you, based on the technology you use (ASP.NET Web Forms or ASP.NET MVC). For example in ASP.NET Web Forms you can ask ASP.NET Web Forms engine
to cache the output of a User Control automatocally by adding OutputCache directive to the user control. In ASP.NET MVC you can you [OutputCache] attribute and apply it to actions.
[OutputCache(Duration = 86400, Location = OutputCacheLocation.All)]
public ActionResult Index()
var model = ProductBL.GetAll();
return View(model);
Also, there is a concept named cache dependency, by which you can specify a dependency for the item being cached. When the condition is met, the cache automatically invalidates and clears.
There are three kinds of cache dependency:
Item dependency: make cached data dependent on another cached data
File dependency: make cached data dependent on a file
Sql dependency: make cached data dependent on the result of a SQL query -
Problem with using a Spatial Query in a report region
All: I am trying to create a report region using the below query. The query is syntactically correct and returns 10 rows. I have checked it out in SQL Developer AND in APEX SQL Workshop. It returns rows in 1-2 seconds.
However, after putting the query into a report region, the APEX page locks up when it runs. I've tried masking it in a view, using other functions. I can places the spatial function in the select clause and it works. However, placing the function in the Where clause causes the page to lock up.
Any thoughts?
Thanks,
John
select lastname, address
from changetracking.individuals
where sdo_nn (spatiallocation, MDSYS.SDO_GEOMETRY(2001,8265,MDSYS.SDO_POINT_TYPE(-87.55728,33.137569,null),null,null), 'sdo_batch_size=10') = 'TQImaging is not officially supported in the Measurement & Automation (MAX) toolkit, though you may find some luck with our free legacy QImaging LabView interface here: http://www.qimaging.com/support/downloads/software/windows/QCamLabViewInstaller221.exe depending on the version lf LabView you're using.If you're looking for something that is actively updated and supported, you may want to get back in touch with Fred at +1.800.874.9789 and ask about our SITK LabView interface as well.
PMQI_Josh,
Yes I've already installed the LabVIEW interface beforehand. Also the version of LabVIEW I'm currently using is 8.6. I'll get in contact with Fred to see if there's a solution to this problem. Thank you. -
Issue with using SHUTTLE in query where clause
Lets say we have a shuttle control on the page with the following 4 values: apple:orange:peach:berry
Lets say I also have a simple SQL query report on the page and I want to use between 1 and 4 of the aforementioned values as part of an "*IN LIST*" sql operation. For example, if the user has selected only apple and orange from the shuttle, I want my query to be:
select * from some_table where fruit IN ('apple', 'orange');
if however, the user has selected all 4 fruits, the query should then read:
select * from some_table where fruit IN ('apple', 'orange', 'peach', 'berry');
I will add the dilemma that I do not want to convert this query to become a PL/SQL based report. Rather, I want to leave it alone as a SQL Query. My initial attempt was to create a hidden item on the page and use APEX_UTIL.STRING_TO_TABLE with a loop to convert the shuttle data to a comma separated list. This worked great, however when I use the this hidden item in my query, it doesn't work properly. I hope I am explaining this well, but when I populate this hidden item, I will get something like this.
apple,orange
Great. Lets say the hidden item above is called P7_HIDDEN_VALUE (for example). I then try to reference it in my query, and here is the problem:
select * from some_table where fruit IN (:P7_HIDDEN_ITEM)
Do you see the problem. The item resolves itself to be apple,orange, when it really needs the quotes to be *'apple','orange'*
Help!!!!Hi,
This post might help
How to enable user to pick which row without using filter in interact. rpt?
Or Bens blog post
http://munkyben.wordpress.com/2010/11/16/handling-aggregated-strings-in-sql-reports/
Regards,
Jari -
How to tack print out use with Query ?
Hi
I have to tack purchase order print out (print details- PO date, BP code, name, item name, Quantity and Amount . System Print Layout means from Purchase Order layout designer) use with Query
How to tack print out use with Query (system print layout means from Purchase Order layout designer) ?
Regards
Aravind MHi
I have to take purchase order print out and I created 3 templates for that purchase order in layout designer (Because as per the MIS requirement I created 3 templates, its cover more information). I have to take print out 3 templates at a time. So i try to take print use with Query.
Regards
Aravind M -
Error erase Queries in Query Manager- The query is used with user-define...
Hello Experts
I have deleted a User Field that had a Formatted Search and now I can not remove it because it is linked according to a UF, the error message is as follows:
"The query is used with user-defined values [Message 952-23]"
There will be a way to resolve this issue???
Thanks in advanceHi Juan,
I have tried this very limited, but the formid, is this a number in your case?
SELECT * from cshs t0 inner join ouqr t1 on t0.queryid = t1.intrnalkey
where t1.qname = '[%0]'
Running this query I can get the form id that I need to recreate, but I have a feeling you already know the form id, is this correct?
- Is there an error when you try to recreate the form id?
- Will it not let you recreate the same form id because the id is given by the system?
If it is not possible to recreate the form id, please prepare a backup and log a message. Support should be able to correct the entry in table cshs.
Hope it helps.
Jesper -
Inner join query used with 7 Database tables
HI All,
In a report they used the Inner join Query with 6 Data base table..now there is a performance issue with at query.
its taking so much of time to trigger that query. Please help how to avoid that performance issue for that.
In that 2 database tables containing lakhs of records..
According to my knowledge it can be avoided by using secondary indexs for those 2 database tables..
and by replacing the Inner join Query with FOR ALL ENTRIES statement.
i want how to use the logic by using FORALL ENTRIES statement for this..
So, please give you proper suggestion to avoid this issue..
Thanking you.
Moderator message: Please Read before Posting in the Performance and Tuning Forum
Edited by: Thomas Zloch on Oct 16, 2011 10:27 PMHi,
And what do you mean with "they used"? If "SAP used" then yo will need to ask a SAP for note
FOR ALL ENTRIES is quite good described in help. Please search forum also.
Without query it won't be possible to tell how it can be optimized, however you can try to use SE30/SAT and ST05. Maybe it will help you.
BR
Marcin Cholewczuk -
Crystal Reports with BEx Query using Custom Exit Variable
Hi,
We have BW BEx Query using Customer User Exit variable to derive the Fiscal Week for Last Year (called it VAR2) based on another user input variable Current Fiscal Week (called it VAR1).
VAR2 is derived from VAR1 in CMOD via some codings and thus it DOES NOT have the "Variable is Ready for Input" flag ticked in the BEx. VAR1 is user input variable, so it has "Variable is Ready for Input" flag ticked in the BEx.
When we create a Crystal Reports with the BEx Query using variable VAR2, and when we run it we got an error message saying "Failed to execute query; '[]<java.lang.UnsupportedOperationException: No Selection State Support!ZP_MI_LYPUBWEEK>'. Redesign your query or contact the data source maintainer to solve the problem". (note: ZP_MI_LYPUBWEEK is VAR2 in this case).
Could anyone please assist? Surely, CR supports BEx customer user exit variables like the above, right?. I also refer to the forum below as it seems to have a similar issue (except mine with an error message), but it does not provide a solution in it.
Crystal Reports with BEx Query using Custom Exit Variable
Thanks,
AndyHi Vibhav,
We have the SAP Crystal Reports for Enterprise XI4.0 Version 14.0.0. Not sure if SP0 or other SP, got to check with Basis Team later.
We tried that "mandatory" option and did not work either.
Anyway, SAP has now come back again saying it is something they will fix it in next release/version. We got a phone call from them and a reply below to our OSS.
23.08.2011 - 08:20:49 CET - Info for Customer by SAP
I have raised this issue on the Idea#s Place as an enhancement request
on the below link:
https://cw.sdn.sap.com/cw/ideas/5586
This ER contains the information of including the customer exit
variables in the report without checking the #input for ready# option.
This ER can be considered for being implemented in the future
versions. You can refer to SAP Note: 1515837 - How To: Enhancement
Request Process - "Idea Place" for more information regarding the Idea
Place.
Cheers,
Andy -
Can we perform Join operation using SQLCall with Datatabae Query
Hi,
I am working on Toplink SQLCall query. I am performing join operation but, it is giving error.
so please, any can tell me . we can perform join operation using SQLCall with Database Query
Thanking You.You can use joining with SQLCall queries in TopLink, provided your SQL returns all of the required fields.
What is the query you are executing and what error are you getting?
Maybe you are looking for
-
Some times when I press the home button to read my finger the screen becomes black and it shows the Apple logo, this take a few seconds to get back the screen and this has been happening even 3 or 4 times in a row! What should I do?
-
Trying to install service pack 2 for WLS 6.0
Hi ! I already have WLS installed and running under a Red Hat Linux release 6.2 (Zoot)Kernel 2.2.14-6.1.1smp on an i686 When I try to install the service pack 2 this happens: ===========================================================================
-
Azure Media Services and Overlays w/XAML storyboards and images
Hi, We are moving our Expression encoder service to the cloud. One feature we rely heavily on is the Overlay feature, utilizing a XAML file with storyboards. In order to do so, I upload some .jpg assets, then add them to the Task's InputAsset.Add()
-
Workflow initiator definition in a local workflow
Hi, workflow gurus. Question is about workflow initiator definition in a local workflow. In my workflow there are, for this moment, two event creators (callers), each of them calls for the same local generic workflow and passes event specific paramet
-
Memory leak in implementing ListModel by myself
Hello, I have created a class which implements ListModel. In this class I overwrite "Object getElementAt(int aIndex)" function of ListModel. What I do inside this function is I read from a file some bytes and with that byte I create Object and return