at the time of billing ,customer creation screen should opens every time no matter what value is there in database property table - sql

, i am getting customer screen for walkin customer but i am not getting this screen for existing customer,please help me
here is the if condition code
if (customerData[25].equalsIgnoreCase
(Configuration.getParameter(ConfigSetting.CUSTOMER_EDIT_CRITERIA))
|| iCalledfromSearch
|| (Configuration.getParameter(ConfigSetting.CUSTOMER_EDIT_CRITERIA))
.equalsIgnoreCase("NA") )

Need to add one more condition as below
(Configuration.getParameter(ConfigSetting.CUSTOMER_EDIT_CRITERIA))
.equalsIgnoreCase("Y") )

Related

Unable to figure out accurate query to get timestamps for my report

I am trying to write a report based on data of users logging into a session.
I need to be able to get a full session time from when the first person joins the meeting to when the last person leaves.
When someone joins a meeting it is logged as, "Initialize-Load Video chat Window"
There are 2 ways to close the meeting but one way is being logged.
- There is an "End Chat" button that the user can use and that is logged as, "Video Chat-End Chat"
- If the user does not use that button and just exits out the program/browser, the database does not log that, and I would like to use the last logged element in the logType column.
I would like it to look like this below:
This is my query:
select vl.originalChatSessionID,
CONVERT(DATE, min(vl.ReceivedDateTime)) as VideoDate,
--CONVERT(TIME, min(vl.ReceivedDateTime)) as StartTime,
min(vl.ReceivedDateTime) as StartTime2,
--CONVERT(TIME, max(vl.ReceivedDateTime)) as EndTime,
max(vl.ReceivedDateTime) as EndTime2,
DATEDIFF(MINUTE, min(vl.ReceivedDateTime), max(vl.ReceivedDateTime)) as SessionLength
from iclickphrDxvideolog vl
--inner join iclickphrDxVideoHistory vh
-- on vl.originalChatSessionID = vh.meetingid
-- and vl.applicationUserID = vh.applicationUserID
where originalChatSessionID = #MeetingSessionID
--and (vl.logType = 'Initialize-Load Video chat Window' or vl.logType = 'Video Chat-End Chat')
group by originalChatSessionID
Problem is I am grabbing the first logged element and last logged element in the logType column, and I know that. If i uncomment the part in the where clause where it says; --and (vl.logType = 'Initialize-Load Video chat Window' or vl.logType = 'Video Chat-End Chat'), then i do not have an issue with the Start time of the session....but have a big issue with the End Time of the session.
Below is a picture of how the raw data looks:
I've a assumed that originalChatSessionID defines a unique session. If not then you will have to change the 'PARTITION BY' clause to mirror the column or columns that make it unique.
This also assumes that ReceivedDateTime is a datetime datatype
SELECT DISTINCT
vl.originalChatSessionID,
VideoDate = MIN(vl.ReceivedDateTime) OVER(PARTITION BY originalChatSessionID),
StartTime = MIN(ISNULL(sc.StartChat, vl.ReceivedDateTime)) OVER(PARTITION BY originalChatSessionID),
EndTime = MAX(ISNULL(ec.EndChat, vl.ReceivedDateTime)) OVER(PARTITION BY originalChatSessionID),
SessionLength = DATEDIFF(
minute,
MIN(ISNULL(sc.StartChat, vl.ReceivedDateTime)) OVER(PARTITION BY originalChatSessionID),
MAX(ISNULL(ec.EndChat, vl.ReceivedDateTime)) OVER(PARTITION BY originalChatSessionID)
)
FROM iclickphrDxvideolog vl
LEFT JOIN (
SELECT originalChatSessionID, StartChat = MIN(ReceivedDateTime)
WHERE logType = 'Initialize-Load Video chat Window'
GROUP BY originalChatSessionID
) sc ON vl.originalChatSessionID = sc.originalChatSessionID
LEFT JOIN (
SELECT originalChatSessionID, EndChat = MAX(ReceivedDateTime)
WHERE logType = 'Video Chat-End Chat'
GROUP BY originalChatSessionID
) ec ON vl.originalChatSessionID = ec.originalChatSessionID
This is untested as I don't have time to recreate your dataset. If you need more help I suggest you post a script to recreate your sample data so people can use it to test against.
The above uses two sub queries, one to get the first instance of Initialize-Load Video chat Window and one to get the last instance of Video Chat-End Chat. I have LEFT JOINed to these so they will return NULL values is nothing is found. In the main part of the query, I've used ISNULL() to test if the start record is not found then use the earliest record for the session and if the end record is not found then use the last record for the session.
Note that there is no grouping but I have used DISTINCT to get a
similar result. This SQL statement does not have a WHERE clause so you
could create a view from it then simply use that view with a WHERE
clause for your report.

How validate two select list in oracle apex

I'm using Oracle apex, and i have 2 select list components that get the elements from the same table. i want build a currency converter, and the list of currency are "divisas"
My problem is: i want validate that when on one select component, one value is selected, the other component doesn't contain that element from select list 1. And vice verse
Also when on select 1 is null on the select 2 must show all result from the table, and vice verse.
I start with this query, but i can't do it works
select *
from divisas
where EN_APP = 'S'
and (
case when :P12_DIVISA is not null then (cod_divi <> :P12_DIVISA) else EN_APP = 'S' end
)
;
can somebody help me?
There's the Cascading List of Values property for Select List items. However, as you want to handle both items at the same time, you'll enter circular reference & dead loop so it won't just work.
Here's an option which does what you wanted; see if it helps:
create two items, e.g. P59_CURR_1 and P59_CURR_2 (for two currencies)
their type is Select List item
Page action on selection = "Redirect and set value"
SQL query looks like this (for P59_CURR_1)
select cod_divi d, cod_divi r
from divisas
where cod_divi <> nvl(:P59_CURR_2, 'X') -- would be `:P59_CURR_1` for another item
order by cod_divi
don't set cascading list of values parent item!
That's it; run the page and see how it behaves. Looks OK to me on apex.oracle.com's Apex 20.1 version.

Incorrect use of DISTINCT

I have a form view that displays the ListingID, PropertyID, ListingAgentID, SaleStatusID, EndListDate and AskingPrice from a database in SQL.
I have a DropDownList that displays the LastNames of agents that when selected it returns back the relevent information in the formView corresponding to the selection.
It's working, but the only problem is that each last name in the dropDownList is duplicated as they each have more than one listing. What I need it to do is when selecting one last name from the DropDownList it returns one value in the FormView, while being able to use paging to view different listings from that agent.
The code in the FormView is:
SELECT[ListingID],
[PropertyID],
[ListingAgentID],
[SaleStatusID],
[EndListDate],
[AskingPrice]
FROM [Listings]
WHERE ([ListingID] = #ListingID)
The code in the DropDownList is:
SELECT Agents.LastName,
Listings.ListingID,
Listings.PropertyID,
Listings.ListingAgentID,
Listings.SaleStatusID,
Listings.BeginListDate,
Listings.EndListDate,
Listings.AskingPrice
FROM Agents
INNER JOIN Listings
ON Agents.AgentID = Listings.ListingAgentID
Where ever I try and put a DISTINCT function it returns an error or doesn't work
Thanks
For the dropdown all you need is an ID as value and the LastName to display.
SELECT DISTINCT Agents.LastName FROM Agents INNER JOIN Listings ON Agents.AgentID = Listings.ListingAgentID

Type conversion failure in update query

I'm fairly new to Access so this is driving me a little crazy.
I'm creating an inventory database and want to count the number of items in stock to update an ordering form. Received items are assigned an order code, and I want to count the number of instances of each order code found within the master table. I have a make table query which does this just fine:
SELECT PrimerList.PrimerName
, First(Primer_Master.FR) AS FR
, Primer_Master.OrderCode
, Count(Primer_Master.OrderCode) AS InStock
INTO PrimerOrder
FROM PrimerList
LEFT JOIN Primer_Master ON PrimerList.ID = Primer_Master.PrimerName
GROUP BY PrimerList.PrimerName
, Primer_Master.OrderCode
, Primer_Master.PrimerName
, Primer_Master.FR
, Primer_Master.Finished
HAVING ((([Primer_Master]![Finished])=No));
I want to use PrimerOrder to update an order list table PrimerOrderList which has all of the different possible order codes, updating the InStock value for records with matching OrderCode:
UPDATE PrimerOrderList
SET PrimerOrderList.InStock = PrimerOrder.InStock
WHERE (((PrimerOrderList.OrderCode)=[PrimerOrder].[OrderCode]));
However, when I try to run it I get parameter boxes which pop-up asking for PrimerOrder.OrderCode and PrimerOrderList.OrderCode. Even if I put in a valid value for each, I get a type conversion failure. I've checked the data types for both tables and don't see how there could be a type conversion failure - both are set to text.
Any insight would be greatly appreciated! Thanks in advance!
You haven't included the PrimerOrder table in your query. Should be:
UPDATE PrimerOrderList INNER JOIN PrimerOrder
ON PrimerOrderList.OrderCode = PrimerOrder.OrderCode
PrimerOrderList.InStock = PrimerOrder.InStock

Need to pull only last date in table that stores change dates SQL / ODBC

Hope somebody can help me with this. I'm trying to pull a list of forthcoming titles (I work in publishing) via ODBC/ms query. I want (amongst other things) to show their internal status (approved, prepress etc.). The database stores the change dates for the status'. I seem to be getting one line per status per title. So if the title has changed status 6 times, I will get 6 lines. But I only want to show the latest status...
The date is in BL_PROJECT_TO_STATUS.STATUS_DATE (I've inserted a date criteria beneath, just to make it more visible).
How can this be done? I'm very new to ODBC and would appreciate it a lot.
SELECT DISTINCT
BL_PROJECT.EXP_PUB_DATE, BL_PROJECT.EAN, BL_PROJECT.TITEL,
MEDIATYPE.DESCRIPTION, BL_PROJECT_STATUS.DESCRIPTION
FROM
FIRMA1.BL_PROJECT BL_PROJECT, FIRMA1.BL_PROJECT_STATUS BL_PROJECT_STATUS,
FIRMA1.BL_PROJECT_TO_STATUS BL_PROJECT_TO_STATUS, FIRMA1.MEDIATYPE MEDIATYPE
WHERE
BL_PROJECT.PROJECT_ID = BL_PROJECT_TO_STATUS.PROJECT_ID AND
BL_PROJECT_TO_STATUS.STATUS_ID = BL_PROJECT_STATUS.CODE AND
BL_PROJECT.MEDIATYPE = MEDIATYPE.ID AND
((BL_PROJECT.PROJECT_TYPE = 2) AND
(BL_PROJECT.EXP_PUB_DATE Between SYSDATE AND (SYSDATE+90)) AND
(BL_PROJECT_TO_STATUS.STATUS_DATE = {ts '2013-11-20 00:00:00'}))
ORDER BY
BL_PROJECT.EXP_PUB_DATE, BL_PROJECT.EAN, BL_PROJECT.TITEL
Here is the general idea. You can adapt it with your table and field names.
select somefields
from sometables
join
(select something, max(datetimefield) maxdt
from table1
where whatever
group by something ) temp on table1.datetimefield = maxdt
etc