Query activities with two fields having OR condition
I am building a module in c# and I need to query all activities that were (created in last 60 days OR that got completed in last 60 days). If this is possible can anyone show me how?
Add two instances of Activity1 to your ListOfActivity array on the input of the query. The filter on the first one should be "created in last 60 days". The filter on the second one should be "created before 60 days ago AND completed in last 60 days". Make sure that both elements in the ListOfActivity array have the same fields populated.
Similar Messages
-
Use DISTINCT with two fields to return one record
I am using OleDB with a SELECT DISTINCT query that is used in C# code to populate a DataGridViewComboBox. The queried table has two fields: ID and Description. The ID field values are unique. Descriptions may be duplicated. The DataSource of my DataGridViewComboBox
is ListBoxItems which is a ListBox that is populated from a table. The ValueMember is ID and the DisplayMember is Description. A sample table might look like this:
ID Description
1 Blue
2 Blue
3 Red
4 Blue
I want my query to return two records; one for the Red description and only one for the Blue description. I don't care which Blue description it returns, but I do need the corresponding ID for the selected Blue record and the ID value for the Red record.
Using SELECT DISTINCT ID, Description FROM... would give me four records instead of two. How can I return only two records in this scenario?
Rob E.Using window function:
create table #temp
ID int,
description varchar(20),
insert into #temp Values(1,'blue')
insert into #temp Values(2,'blue')
insert into #temp Values(3,'red')
insert into #temp Values(4,'blue')
;WITH CTE AS (select RN=ROW_NUMBER() OVER (PARTITION BY description ORDER BY newid() ),
ID,description from #temp)
SELECT ID, description from CTE
WHERE RN = 1;
ID description
4 blue
3 red
Kalman Toth Database & OLAP Architect
SQL Server 2014 Database Design
New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014 -
Adding a custom tab in Purchase Order with two fields - ME21N
Hello Experts,
My requirement is to add a custom tab with two fields in purchase order at header level.
The BADI ME_PROCESS_PO_CUST is alreday implemented previously as there was one custom tab added previously in header.
The structure CI_EKKODB already have the custom fields for the enhancement done earlier.
Now to add my additional tab how should i proceed ....should i put my additional fields in the same structure and write my code in same BADI.....will there be any impact on already done enhanecement.
Please suggest in achieving this functionality.
Thanks,
NaveenHi,
Check this [wiki|http://wiki.sdn.sap.com/wiki/display/ABAP/DetailedexplanationaboutBADIandthewaystofindtheBADIwithanexample%28ME23n+transaction%29], it tells you how to do with an example for item data.
Regards,
Eduardo -
How join the two query block with same field
sorry sir i am posting dublicate thread
i thought you not understand my question
sir i have two query block in report with same field
i try the link object but that creat now block not creat link withen query block
please give me idea
thankDear,
Use data link object.
Click at data link object then click on the fild in query block1 and drag it into the other query block data link will be created.
try it -
Generic delta using function module with two fields AEDAT AND ERDAT
Hi,
i have scenario that i have to create a generic data source having delta using funcation module and the delta speci fields are AEDAT AND ERDAT . Is there possibility with out using these two fields ( i mean AEDAT AND ERDAT) in the extract structure can i create the data source . and provide sample code for me . it is very urgent.
waiting for the reply,
sri.cHi Sri,
here some coding, I hope this helps!
first, get the delta-field
LOOP AT s_s_if-t_select INTO l_s_select.
CASE l_s_select-fieldnm.
WHEN 'ZDATE'.
MOVE-CORRESPONDING l_s_select TO r_date.
IF r_date-high IS INITIAL OR r_date-high = space.
r_date-high = '9991231'.
ENDIF.
APPEND r_date.
ENDCASE.
ENDLOOP.
Cursor öffnen
OPEN CURSOR WITH HOLD s_cursor FOR
SELECT * FROM
WHERE ....
AND erdat in r_date
AND aedat IN r_date.
FETCH NEXT CURSOR s_cursor INTO CORRESPONDING FIELDS OF table e_t_data package size s_s_if-maxsize.
regards
Siggi
PS: Note that this coding only works for a very straight forward extraction.
Message was edited by: Siegfried Szameitat -
i have an array with three fields: id, name and date.
i want to sort it by name first and then date.
the size of my array could be as large as 1 million.
what could be the most efficient way to do so?
tia!It's very inefficient to sort an array on "the fly".
In that case at least use a linked list so you don't
have to move all elements after the insertion point to
make room for a new insert. But it's much better to
sort afterwards when all elements are in the array.Use a TreeSet. A linked list will be slower than a TreeSet, I suspect.
I believe that with a TreeSet, insertions will be somewhat slower (O(logN) vs O(c)), but the subsequent sorting of a linked list will be, what, at least O(NlogN) and possibly O(N^2)? And when you're inserting the first elements into the TreeSet, it should be closer to O(c) anyway, whereas the after-the-fact sorting of a LinkedList wouldn't have an advantage like that.
Then if necessary extract an array out of the TreeSet when you're done creating/inserting elements.
But really, use a database. -
Hi,
Can it be possible to have Delta on two fields in Generic Data Source?
If yes, Please let me know the Procedure.
Thanks,
Ram.hi,
generic data source is nothing but if u used one data source to upload the data to one ods. at that time u want the same data source for next cube also.that time u crete the generic data source and create transformation ods to cube and also create the dtp ,upload the data.
delta means its filter the same records present in next time.
1.create data source and infopackage.
2.upload the data to datasource(psa).
3.create ods.
4.create transformation.(use that data source).
5.create dtp.
6.execute the data.
7.create cube.
8.right click the ods.
9.create generic data source.
10.right click the ods create transformation(use torget as cube)
11.create dtp.
12. that will have full or delta updates .
13. use delta update.
14.execute the data.
if its helpfull assign points.
thanks.
prakasu -
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); -
Dataload - evaluate two fields for a condition
Hi, I need to evaluate two different fields in a dataload rule and apply condition if true. for instance if field 1 is 600 and field 2 is 30 the change field 1 to 650.
Hello Siggi,
i have to create an delta enabled extractor for a database table.
The database table (=EAUS) contains the fields "ERDAT" and "AEDAT".
I'm a Newbie in ABAP und so i read some blogs, articles and how to do papers here.
But my tests haven't work:
1. I created a structure in SE11 for extraction. The structure contains all the of the database tabel (=EAUS)
2. Then I created a data element "ZDATE" in SE11. I integrated ZDATE in the structure.
3. Then I copied function group "RSAX" and function module "RSAX_BIW_GET_DATA_SIMPLE" in our namespace.
4. I used the copied function module as a template and adapted the coding in the function module. The coding is from the paper "Functional Module Based Delta Enabled Generic Datasource"
But i doesn't work. My deltaenabled generic datasource doesn't get the deltas. In RSA3 with update mode "D" no data records were selected. (I create new records in the database EAUS before I checked the extraction). The update mode "F" and "C" works.
Can you help me and send me the coding of your function module?
Many thanks!
Jan -
Use REST API to query contacts with a field updated since certain time?
Hello,
Using the REST API and trying to figure out how I can query for contacts that have had a field updated since a specified time. I've tried using the "lastUpdatedAt" arg, but to me it seems like I'm getting back contacts that maybe haven't had any data change, but were probably sent an email or something of that sort (so the updated at value was changed)
Is there a way to query for contacts that have had fields change (Like subscriptions, address, title, etc) but exclude those contacts that only have their updated values changes because they were sent an email?
Thanks!Hi Chris,
lastUpdatedAt or "Date Modified" fields don't change when the contact is sent an email, but rather, when ANY field is modified on the contact record. You can certainly query for and export contacts that had their data touched in some way since a specified time, but it won't be on a per-field basis. There is effectively no field level change history or tracking. You can work around this with extra logic. First, you can get a snapshot of what the values were in the specific fields you want to track across your entire database.
The next time you run an export using Date Modified, it will contain more records than you might care about, but you can filter offline for the ones you do care about by comparing their before and after values for the specific 'tracked' fields.
Regards,
Bojan -
How to get difference the min of two columns having different conditions ?
Hello,
I am trying to write a query which staisfies the following condittion. I have a table emp which has the following colums empno,ename,deptcode,empstat_code,salary.
The salary of employees depends on the empstat_code.
For a given deptcode, I have to compare the mimimum of salaries for empstat_code 'A' with the minimum of salaries for empstat_code 'B' and then a get a difference between the two.
How can I do this, please advise.
Thanks
fmSomething like this perhaps.
create table my_emp as
select
from scott.emp
alter table my_emp add emp_stat varchar2(1);
update my_emp set emp_stat= case when mod(rownum, 2) = 0 then 'A' else 'B' end;
select * from my_emp;
TUBBY_TUBBZ?select
2 min(decode(emp_stat, 'A', sal)) as min_A_sal
3 , min(decode(emp_stat, 'B', sal)) as min_B_sal
4 , deptno
5 from
6 my_emp
7 group by
8 deptno;
MIN_A_SAL MIN_B_SAL DEPTNO
950 1250 30
2975 800 20
1300 2450 10
3 rows selected.
Elapsed: 00:00:00.71Keeping in mind that MIN will return NULL if there are no values for a given emp_stat and deptno combination. So you would have to account for that however your business rules tell you to account for it (likely using NVL to 0) -
Howto select all entries with two fields value
Hi all,
I have the following SELECT stmt:
SELECT SUM( betrw )
INTO l_real_t
FROM dfkkop
WHERE opbel = l_opbel
AND hvorg <> gc_hvorg_dun_fee
AND tvorg <> gc_tvorg_dun_fee.
Now I get no lines, where hvorg = gc_hvorg_dun_fee OR tvorg = gc_tvorg_dun_fee.
But my intention is to get no lines, where BOTH conditions are met.
What am I doing wrong here?
Kind Regards, MatthiasCheck this..
SELECT SUM( betrw )
INTO l_real_t
FROM dfkkop
WHERE opbel = l_opbel
AND NOT ( hvorg EQ gc_hvorg_dun_fee
AND tvorg EQ gc_tvorg_dun_fee). -
Report generation with two tables having no join
Hi,
I would like to know if i can generate a report to view data from purchase and sales tables at one time even if they are not directly linked.
Regards,
Bhavnahi jain,
You can use Union All to combine sql queries of sales and
purchase tables.
Jeyakanthan. -
Master-Detail query problem with composite key
I have tested a MD form with EMP and DEPT tables and the MD query works okay.
I have created two tables both with two fields EMP_ID and REPORT_DATE as a composite key. The problem I am having with the MD form is that it does not query back the results when I select the QUERY button. I have verified that the join is setup during the creation of the form.I have recreated the form and the MD query works fine.
-
Dynamic Table with two columns
Hi!
i have to create a Dynamic Table with two columns having 5-5 links each with some text...... three links r based on certain conditions....they r visible only if condition is true...
if the links r not visible in this case another links take it's place & fill the cell.
links/text is coming from database.
i am using Struts with JSP IDE netbeans
Please help me
BuntyIndiai wanna do something like this
<div class="box_d box_margin_right">
<ul class="anchor-bullet">
<c:forEach items="${data.faqList}" var="item" varStatus="status"
begin="0" end="${data.faqListSize/2-1}">
<li>${item}</li>
</c:forEach>
</ul>
</div>
<div class="box_d">
<ul class="anchor-bullet">
<c:forEach items="${data.faqList}" var="item" varStatus="status"
begin="${data.faqListSize/2}" end="${data.faqListSize}">
<li>${item}</li>
</c:forEach>
</ul>
</div>
wanna divide table in two columns....if one link got off due to condition other one take it's position...
I have created a textorderedlist
Bunty
Maybe you are looking for
-
PCI USB2 Controller card conflicts with network card
I've installed a PCI USB2 controller card since my motherboard (IWill K266-R) only has support for USB1. However, the card seems to conflict with one of my network cards, because traffic on the internet-connected NIC is very slow, and often drops com
-
I'm getting the following exception while starting the IBM websphere server administrator's console: Exception: Namecom.ibm.ejs.sm.exception.AttributeNotSetException: Name at com.ibm.ejs.sm.beans.Attributes.getGeneric(Compiled Code) at com.
-
JNDI lookup, uncheked bean and LoginModule
Hi people! I have stateless session bean with uncheked method permissions.My application use custom login module. When I try to lookup it home interface the container invoke my login module. Why it do so? This is incorrect behaviour, I think. Why con
-
Hellone
-
Projects Published to AC from Captivate 6 have playback issues.
My end users are begining to complain about poor video playback from projects I publish to Adobe Connect using Captivate 6 64-bit on Windows 7. They claim that slides that contain a video will either 1. never completely load, or, 2. once they do load