How to design a db on firestore or firebase realtime db for a rotating shift [closed] - database

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm not sure how to model a DB on firebase for a rotating shift. There's a 12 hour day and night shift and it rotates every 2 weeks.
My current hackish solution is to just use json and define every single day in a year with who's working day and night shift, like below. But it's obviously not optimal as I would have to define it every year, and I want it to be easy to add on other employee/shift details later.
year{
month{
day{
1{empX:night,
empY:morning;
}
}
}
}
I've looked into other answers and a few videos and search results but I couldn't find what I'm looking for. I'm also open to using mysql instead but I want to try using firebase because of the one-stop console.
Hope the question is clear enough.

If the employees don't change during the 2 weeks (meaning you don't need per-day customization, just per-2-week customization), would something like this work? I don't know enough about your needs, but this came to mind:
shifts (collection)
shiftId (Firebase generated doc id)
start (timestamp)
end (timestamp, 2 weeks later)
dayShift (array)
employeeId (string)
employeeId (string)
employeeId (string)
nightShift (array)
employeeId (string)
employeeId (string)
employeeId (string)

Related

Query that return city name and how many records exists in that city? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have created a project in C#. In my database I have a table "Users" in which there is a field "City". Now I want to put some query that returns all the cities and how many users belongs to that city. For example there are 9 users in that table and 3 users live in New York, 3 in Chicago and 3 in Washington so the output should be:
City- New York, Records- 3
etc.
Thanks.
Group by city and then get the count of cities.
select City, count(City) as Records
from Users
group by City

how to write sql query to count? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I want to write a query for count 'noOfDistribution' within a date
and by reference. for example, there are 2 in 1/5/2013.
In addition,can someone recommend some ebook/website to learn advanced skills in
query? Thanks for helping.
Answering your question:
SELECT input_Date, REFERENCE, count(*)
FROM YourTable
GROUP BY input_Date, REFERENCE
But it will result something different you pointed, since for the date 2/5/2013, it will count 6 elements for REFERENCE null
You can do something like thiss....
select count(Input_date) over (partition by Input_date,reference),* from table
By this you can find count of Particular date such as 1/5/2013 has 2 count
alternative way
select date,reference,count(*) from table group by date,reference

ORACLE select lacks row [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I use ORACLE setup RAC cluster.
My problem is when DB got problem (still dont know the reason ) my sql select lacks rows
example:
select *
from student_detail
where student_id = 1231
should return 10 row data of student have id 1231, but in this case just return 6 rows
can anybody help me to understand this problem!
As a general observation, an Oracle SELECT always returns the correct number of rows. If the result set does not match your expectation then there is a problem with your understanding.
For instance you may have miscounted the number of rows with student_id = 1231. If the query returns only six rows how do you know there are supposed to be ten? It might not be as simple as eyeballing ...
select * from student_detail
order by student_id
... if student_id has a varchar2 datatype and some IDs are suffixed with stray spaces. A query like this will diagnose that problem:
select student_id, count(*)
from student_detail
group by student_id
order by student_id
Other possible causes? A misleading view? Row Level Security restricting the result set? Some bizarre client-side configuration which only shows the first six rows instead of the entire set?
You mention RAC. RAC uses a mechanism called the Global Cache Service Process to transmit changed data to different nodes. It is possible you are experiencing a failure in this process. Talk to your DBA and get them to investigate.
Maybe, the data should be wrong.
for example, if the data of user_id is '1231', that's not wrong, but if the data is left gap
like ' 1231', you can't see the data.
' 1231 ' , '1231 ' also can not be printed out.
The solution is when you insert some data, use the function 'trim' or 'replace'...
trim is only remove left gap.

Unable to show report in desire format [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I asked this question before and someone vote down myquestion saying that this question is not valid. I have spent three days on this problem. So please if you do not understand it , it does not mean that the question is invalid. Here it is:
I have created a SSRS report. I am facing problem with respect to page break and Grouping.
Here is the out put of my report.
On each page I want to show record group by Landing Date and Buyer Name.
That is on first page following should be shown:
Buyer Name Landing Date Actual Price
SHETLAND 06-Jan-05 100989.754569257
On second page:
Buyer Name Landing Date Actual Price
SHETLAND 11-Jan-05 1096677.95045137
On third page:
Buyer Name Landing Date Actual Price
FRESH 14-Jan-05 300080.972657965
SHETLAND 14-Jan-05 157372.157557842
==========================================================================
I applied Grouping using group properties , but no effect. Basically I want to show records with same landing date on one page.
Try to create Grouping on two level (nested). That is first group by Landing Date and then right click on newly created group and create a child group . and in child group create expression to group by Buyer Name. Hope it will work.
You need to add a row group with the group by on Landing Date and Buyer name, and then in the group properties tick the check box for 'Add a page break between instances of a group'

Automatic generate a sales order line for every sales order [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Im experimenting with Dynamics Nav 2009.
Is there a way to automatically insert a sales line every time I make a new sales order?
I want postage to be included everytime Im making a new sales order.
There are two ways to solve this, one without programming, and one almost without programming.
If you postage line is a standard "charge" added to all orders then you can actually use the "Invoice Discount" functionality. Besides allowing you to assign an actual discount (typically being applied if the order is above a specific amount), then you can also use the functionality to add a "Service Charge". Either to be inserted on all orders, or only if the order total is below a certain "Minimum Amount".
You set it up by specifying the "Invoice Discount Code" field on the Customers and enable the automatic calculation in the "Calc. Inv. Disc." field in "Sales & Receivable Setup" table. The postage lines are not inserted as actual sales lines, but are calculated and applied when posting (or using the total / statistics button).
The other option is the use the "Standard Sales Codes". Here you can specify a number standard lines which are to be inserted whenever the standard sales code are selected. This is where I said a little programming is required, as the system doesn't automatically insert the lines. But you can insert a call to the function to insert the lines automatically when the customer no. has been entered.
This change would most likely require a modification from your NAV Partner.
The modification could add C/AL code to automatically insert a new Sales Line every time a new Sales Header record is created.
OnInsert()
SalesLine.INIT;
SalesLine."Document Type" := "Document Type";
SalesLine."Document No." := "No.";
SalesLine."Line No." := 0;
// Additional Code
SalesLine.INSERT(TRUE);

Resources