I can't get my search working with re.findall() - screen-scraping

salary='competitive salary from £25,850 up to £33,000* (depending on experience) with 30 days’ holiday per year (pro rata)'
salary_lowerbound=re.findall(r"from £[0-9]{2}[,][0-9]{3}", salary)
print(salary_lowerbound)
gives me
['from £25,850']
but when I tried to do the same from the html I was scraping from it returned empty list
salary=soup.find("div", class_="oJobDescription-textContainer-wrapper").text
please help

Related

Salesforce Get a list of all opportunities which are new, updated or deleted since a given date using api

I am trying to receive a list of all opportunities that are created/updated/deleted since a given date. When I run query: SELECT Id FROM Opportunity WHERE SystemModStamp >= '2022-09-20' AND isDeleted = TRUE ALL ROWS I get a response stating "message": "ALL ROWS not allowed in this context", "errorCode": "MALFORMED_QUERY".
Going over the salesforce documentation I found out using queryAll() api method we can also get the opportunities which are created/updated/deleted. But I am not able to find an example of how to use this api. Any help in this direction would be highly appreciated.
Salesforce queryAll documentation: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_queryall.htm
Have you tried using queryAll instead of query? Start with
/services/data/v54.0/queryAll?q=SELECT+Id,+Name,+isDeleted,+StageName+FROM+Opportunity+ORDER+BY+isDeleted+DESC+LIMIT+20
and experiment, remove the ORDER BY, put filter by date...
SELECT Id, Name, isDeleted
FROM Opportunity
WHERE LastModifiedDate >2022-09-01T00:00:00Z
There's also dedicated "data replication API" which you can use to get opportunities updated / deleted in given time window (imagine an oppty that's edited 3 times in September, once in October - the last modified date will happily say October, how would you retrieve the fact it was touched in September too?). It'll give you just the IDs, you'd have to collect them and send the query for actual data - but it's something.

Add columns to a set of results depending how many rows found

I don't have sample datathat fits the example below, and it's more a theoretical question rather than a data-driven one...
I have a table called CustomerOrders. A query looks to see if any customers haven't ordered anything for more than 4 days (again, it's just an example but easier than explaining the real purpose).
If there are such customers, then the query searches an Communications table that records whether or not sales staff have noted that it's been four days or more since an order was received from that customer, and what action they're taking to address this.
Depending on the number of days since the last order, and the number of times sales staff have logged their acknowledgement (ideally it should be every day until they place an order), each customer appears in the results like this:
FirstName, LastName, LastOrderDate, NumDaysSince, SalesStaffCommentDate, SalesComment
At present, each entry sales staff log a comment about this date gap appears as a separate row in this result set, each essentially repeating themselves, other than the last two columns.
What I would prefer is for this result set to be set out as:
FirstName, LastName, LastOrderDate, NumDaysSince, SalesStaffCommentDate[1], SalesComment[1], SalesStaffCommentDate[2], SalesComment[2]
etc, with the number of additional comment and date columns showing the comments made, but all on one row.
But if the sales team only logged two comments on one customer, but ten comments on another, there is obviously a disparity between the number of columns that could be filled.
Is it possible to display the data in this way?
EDIT - thanks to #Larnu and #Smor so far.
To try and give a bit more data. This is how my data looks:
NAME LASTORDERDATE NUMDAYSSINCE SALESSTAFFCOMMENTDATE SALESCOMMENT
John Smith 2022-06-12 5 2022-06-15 Tried to call
John Smith 2022-06-12 5 2022-06-16 Call back later
John Smith 2022-06-12 5 2022-06-17 Not required
I want it to look like this:
John Smith 2022-06-12 5 2022-06-15 Tried to call 2022-06-16 Call back later 2022-06-17 Not required.
There may be anything from 1 - 10 entries before the customer orders again and reset the counter back to being < 4 days since their last.
#larnu, are you saying that the link you give allows me to present the data in this way? Ordinarily I would export this data to PBI and pivot it to display as I need it to, but for this bit of data I'm unable to do that, and so it needs to be in SQL.
Hope that clarifies things in case I was being a bit too vague.

Is there a way to consolidate multiple formulas into one

all:
I am trying to design a shared worksheet that measures salespeople performance over a period of time. In addition to calculating # of units, sales price, and profit, I am trying to calculate how many new account were sold in the month (ideally, I'd like to be able to change the timeframe so I can calculate larger time periods like quarter, year etc').
In essence, I want to find out if a customer was sold to in the 12 months before the present month, and if not, that I will see the customer number and the salesperson who sold them.
So far, I was able to calculate that by adding three columns that each calculate a part of the process (see screenshot below):
Column H (SoldLastYear) - Shows customers that were sold in the year before this current month: =IF(AND(B2>=(TODAY()-365),B2<(TODAY()-DAY(TODAY())+1)),D2,"")
Column I (SoldNow) - Shows the customers that were sold this month, and if they are NOT found in column H, show "New Cust": =IFNA(IF(B2>TODAY()-DAY(TODAY()),VLOOKUP(D2,H:H,1,FALSE),""),"New Cust")
Column J (NewCust) - If Column I shows "New Cust", show me the customer number: =IF(I2="New Cust",D2,"")
Column K (SalesName) - if Column I shows "New Cust", show me the salesperson name: =IF(I2="New Cust",C2,"")
Does anyone have an idea how I can make this more efficient? Could an array formula work here or will it be stuck in a loop since its referring to other lines in the same column?
Any help would be appreciated!!
EDIT: Here is what Im trying to achieve:
Instead of:
having Column H showing me what was sold in the 12 months before the 1st day of the current month (for today's date: 8/1/19-7/31/20);
Having Column I showing me what was sold in August 2020; and
Column I searching column H to see if that customer was sold in the timeframe specified in Column H
I want to have one column that does all three: One column that flags all sales made for the last 12 months from the beginning of the current month (so, 8/1/19 to 8/27/20), then compares sales made in current month (august) with the sales made before it, and lets me know the first time a customer shows up in current month IF it doesn't appear in the 12 months prior --> finds the new customers after a dormant period of 12 months.
Im really just trying to find a way to make the formula better and less-resource consuming. With a large dataset, the three columns (copied a few times for different timeframes) really slow down Excel...
Here is an example of the end result:
Example of final product

Sql to show total hours on time card with sum for the whole month

I need help in SQL to get the total hours worked on the time card if possible sum it for the entire pay period.
Here is the command i have built right now but i dont know why its not displaying the record
select personid, personnum, DURATIONDAYSQTY/3600 as amount, CURRPAYPERIODEND
from VP_EMPLOYEEV42
left join [dbo].WFCTOTAL on [dbo].WFCTOTAL.EMPLOYEEID = [dbo].[VP_EMPLOYEEV42].PERSONID
where HOMELABORLEVELNM1 = 'JP' and PAYCODEID in('1167','1163');
I hope that you can guide me on how i can make the effective date from the start of the pay period to end so that it would only capture the hours of the employees per pay period.
I also need to display as an output the total hours of the employees in one line example 200 hours for the entire month of January
sample screenshot
enter image description here
the above screenshot is the source and my expected output is this
enter image description here
thanks a lot

Forecast on payments for 5 Years

I've been given the task of creating a data extract that shows how much money an account will make over the next five years(monthly) based on its current rate of payment.
So using 1 example account that pays £1000 a month, which owes £12,000 overall, I can predict we will get £1000 a month and that in 12 months the payment will be settled and every month from then would carry a zero.
I can't work out how to create an SQL query that gives me that, it needs to look at the balance and last payment received, then create a payment for each future month until that balance is zero.
I think I may be over complicating it, All I have managed to come up with so far is some code that tells me how many months it would take to clear based on the last payment which is basically just a balance divided payment. So as it is I have created a query that gets, last payment, number of months till its paid. What I need to do is get it to use the count of months till paid to create future months?
Desired output:
Month|Payment
Jun-14|£1000.00
Jul-14|£1000.00
Aug-14|£1000.00
Sep-14|£1000.00
Oct-14|£1000.00
Nov-14|£1000.00
Dec-14|£1000.00
Jan-15|£1000.00
Feb-15|£1000.00
Mar-15|£1000.00
Apr-15|£1000.00
May-15|£1000.00
Jun-15|£0.00
Jul-15|£0.00
Aug-15|£0.00
Sep-15|£0.00
Oct-15|£0.00
Nov-15|£0.00
Dec-15|£0.00
Jan-16|£0.00
Feb-16|£0.00
Mar-16|£0.00

Resources