PS Query - how to generate an output that includes "current month deduction" and "YTD total deduction"? - peoplesoft

I have been tasked with generating a report in Query Manager in HRMS to create an output file that shows in one column the current month deduction and then a running YTD total deduction based on the same dedID.... is this possible?
Example:
ID: 123
effDt: 1/1/2016
dedAmt: $10
ID: 123
effDt: 2/1/2016
dedAmt: $15
ID: 123
effDt: 3/1/2016
dedAmt: $20
ID: 123
effDt: 4/1/2016
dedAmt: $10
(curr record)
I need my output to generate something like:
effDt: 4/1/2016 | ID: 123 | YTD_Ded: $55 | Curr_ded: $10
Obviously, I have a list of deductionIDs that I will need to deal with... but I've been messing around with query manager for awhile now and I haven't been able to figure out how to generate this and I can ONLY use query manager... anyone have any idea?
thanks

Can you use an expression for the calculated field?

Related

Add label to webform options in Drupal 8

I'm trying to group the option values by categories, and I want to add a label for each category. For example:
group A
Doctor: Doctor
group B
Nurse: Nurse
Student: Student
Others: Others
Can I do that without custom or alter function? My YAML:
Doctor: Doctor
Nurse: Nurse
Student: Student
Others: Others
I found out the solution.
Ex:
pets:
- Cat
- Dog
- Goldfish

I want to run a job every 4 hours starting from 9 AM Wednesday till 8:59 AM Thursday in Autosys

I have given the below conditions to run every 4 hours during those days, but the problem is the job is running at 01:00, 05:00 and 08:58 on Wednesdays. I expect the job to run from 09:00 AM Wednesday till 08:59 AM Thursday.
insert_job: file_watcher.0000.000 job_type: BOX
date_conditions: 1
days_of_week: we,th
start_times: "09:00,13:00,17:00,21:00,01:00,05:00,08:59"
run_window: "09:00 - 08:59"
description: "File watcher job"
Could someone guide me how to modify the conditions to achieve this.
This is not possible by 1 job definition.
Suggest you, create 2 jobs one for Wed and Thurs with their respective timings.

Retrieving data with dynamic attributes in Cassandra

I'm working on a solution for Cassandra that's proving impossible.
We have a table that will return a set of candidates given some search criteria. The row with the highest score is returned back to the user. We can do this quite easily with SQL, but there's a need to migrate to Cassandra. Here are the tables involved:
Value
ID | VALUE | COUNTRY | STATE | CITY | COUNTY
--------+---------+----------+----------+-----------+-----------
1 | 50 | US | | |
--------+---------+----------+----------+-----------+-----------
2 | 25 | | TX | |
--------+---------+----------+----------+-----------+-----------
3 | 15 | | | MEMPHIS |
--------+---------+----------+----------+-----------+-----------
4 | 5 | | | | BROWARD
--------+---------+----------+----------+-----------+-----------
5 | 30 | | NY | NYC |
--------+---------+----------+----------+-----------+-----------
6 | 20 | US | | NASHVILLE |
--------+---------+----------+----------+-----------+-----------
Scoring
ATTRIBUTE | SCORE
-------------+-------------
COUNTRY | 1
STATE | 2
CITY | 4
COUNTY | 8
A query is sent that can have any of those four attributes populated or not. We search through our values table, calculate the scores, and return the highest one. If a column in the values table is null, it means it's applicable for all.
ID 1 is applicable for all states, cities, and counties within the US.
ID 2 is applicable for all countries, cities, and counties where the state is TX.
Example:
Query: {Country: US, State: TX}
Matches Value IDs: [1, 2, 3, 4, 6]
Scores: [1, 2, 4, 8, 5(1+4)]
Result: {id: 4} (8 was the highest score so Broward returns)
How would you model something like this in Cassandra 2.1?
Found out the best way to achieve this was using Solr with Cassandra.
Somethings to note though about using Solr, since all the resources I needed were scattered amongst the internet.
You must first start Cassandra with Solr. There's a command with the dse tool for starting cassandra with Solr enabled.
$CASSANDRA_HOME/bin/dse cassandra -s
You must create your keyspace with network topology stategy and solr enabled.
CREATE KEYSPACE ... WITH REPLICATION = {'class': 'NetworkTopologyStrategy', 'Solr': 1}
Once you create your table within your solr enabled keyspace, create a core using the dsetool.
$CASSANDRA_HOME/bin/dsetool create_core keyspace.table_name generateResources=true reindex=true
This will allow solr to index your data and generate a number of secondary indexes against your cassandra table.
To perform the queries needed for columns where values may or may not exist requires a somewhat complex query.
SELECT * FROM keyspace.table_name WHERE solr_query = '{"q": "{(-column:[* TO *] AND *:*) OR column:value}"';
Finally, you may notice when searching for text, your solr query column:"Hello" may pick up other unwanted values like HelloWorld or HelloThere. This is due to the datatype used in your schema.xml for Solr. Here's how to modify this behavior:
Head to your Solr Admin UI. (Normally http://hostname:8983/solr/)
Choose your core in the drop down list in the left pane, should be named keyspace.table_name.
Look for Config or Schema, both should take you to the schema.xml.
Copy and paste that file to some text editor. Optionally, you could try using wget or curl to download the file, but you need the real link which is provided in the text field box to the top right.
There's a tag <fieldtype>, with the name TextField. Replace org.apache.solr.schema.TextField with org.apache.solr.schema.StrField. You must also remove the analyzers, StrField does not support those.
That's it, hopefully I've saved people from all the headaches I encountered.

How to use recursive with dates in Teradata?

I have the following table for people running a marathon
person start end
mike 2-Jun-14 2-Jul-14
nike 3-Jul-14 9-Aug-14
mini 1-Aug-14 3-Sep-14
sara 25-Jun-14 27-Jun-14
steve 12-Jun-14 3-Jul-14
stan 2-Jun-14 2-Aug-14
pete 3-Jul-14 9-Aug-14
tara 5-Jul-14 5-Sep-14
I need to create a table that shows if a person was in the process of running at the beginning of every month
On Jul 1, 2014 there were 3 people running the marathon: mike,
steve, stan
On Aug 1,2014 there were 5 people: nike, mini, stan,
pete,tara
On Sep 1,2014 there were 2 people: mini, tara
etc . .
The desired table should look like this
person running on
mike 1-Jul-14
nike 1-Aug-14
mini 1-Aug-14
mini 1-Sep-14
steve 1-Jul-14
stan 1-Jul-14
stan 1-Aug-14
pete 1-Aug-14
tara 1-Aug-14
tara 1-Sep-14
Right now, to do this I am running a separate query for each month. This is very tedious I suspect that i should be usingrecursive, but I do not know how to implement it here.
PS: I have Teradata 14 with all functions, except I cannot write my own udfs and procedures. How can I get the final table using Teradata sql ?
There's no need for recursion or a procedure, this is done using some proprietary Teradata SQL extension:
SELECT person, BEGIN(pd)
FROM vt
EXPAND ON PERIOD(start, end) AS pd BY ANCHOR MONTH_BEGIN

How to copy a value from a certain pattern in R?

I have a data file, each row may have different format, but the certain pattern "\\- .*\\| PR", the data set is kind as following:
|- 7 | PR - Easy to post position and search resumes | Improvement - searching of resumes
[ 1387028] | Recommend - 9 | PR - As a recruiter I find a lot qualified resumes for jobs that I am working on.
|- 10 | PR - its easy to use and good candidiates
I want to have a record of the number in this pattern, or the data I offered, I need a record of 7, 9,10. I have no idea about how to do it, is there someone can help?
as.integer(sub('.*- ([0-9]+) \\| PR.*', '\\1', yourvector))

Resources