Distribute Donation
C:\Users\pasccout\Downloads\challenge_146\StoreData.yxdb
StoreData.yxdb
20
4
10
2000
10
Values related to challenge
Error
Get the challenge attributes
[customerRating] >= [Minimum Customer Rating] And
[numReviews] >= [Minimum Number of Reviews] And
[stock] = "Available" And
! IsNull([salePrice])
Custom
=
True
fixed
2018-12-19 07:50:32
0
2018-12-19 07:50:32
2018-12-19 07:50:32
Customer Rating, Number of Reviews and in Stock
[customerRating] >= [Minimum Customer Rating] And
[numReviews] >= [Minimum Numb...
categoryPath
Last
categoryPath
Split the categoryPath to identify SolutionCategory
Put everything that the first word is Clothing in the categoryPath as Clothing...
Everything else... Beauty...
Calculate Total Donation
SolutionCategory = If [categoryPath1] = "Clothing" Then
"Clothing"
Else
"H...
SolutionCategory - Ascending
customerRating - Descending
salePrice - Ascending
name
IncrementalTotal
Double
8
Empty
If [Row-1:SolutionCategory] = [SolutionCategory] Then
If [Row-1:IncrementalTotal] + ([salePrice] * [Max of Same Item]) <= [Total Donation] / 2 Then
[Row-1:IncrementalTotal] + ([salePrice] * [Max of Same Item])
Else
(Floor((([Total Donation] / 2) - [Row-1:IncrementalTotal]) / [salePrice]) * [salePrice]) + [Row-1:IncrementalTotal]
EndIf
Else
If [salePrice] * [Max of Same Item] <= [Total Donation] / 2 Then
[salePrice] * [Max of Same Item]
Else
[Total Donation] / 2
EndIf
EndIf
Calculate Incremental Total
If [Row-1:SolutionCategory] = [SolutionCategory] Then
If [Ro...
name
Keep
Int32
4
Empty
If [IncrementalTotal] != [Row-1:IncrementalTotal] Then
1
Else
0
EndIf
Determine the rows to keep
If [IncrementalTotal] != [Row-1:IncrementalTotal] Then
1
Els...
[Keep] = 1
Simple
=
Keep
True
fixed
2018-12-19 08:33:54
0
1
2018-12-19 08:33:54
2018-12-19 08:33:54
[Keep] = 1
name
Number of Items to Purchase
Int32
4
Empty
If [Row-1:SolutionCategory] = [SolutionCategory] Then
Floor(([IncrementalTotal] - [Row-1:IncrementalTotal]) / [salePrice])
Else
Floor([IncrementalTotal] / [salePrice])
EndIf
Calculate the number of items
If [Row-1:SolutionCategory] = [SolutionCategory] Then
Floor(...
C:\Users\pasccout\AppData\Local\Temp\Engine_9956_32237eed958c43fb92d52d559211b3f3_\Engine_13104_0ffffc9fa17747a2b96486f9b7a52379_.yxdb
Single
Profile
Error
Append the number of existing solutions
Add 1 to the number of solutions to include my own
Count number of attachments
https://community.alteryx.com/t5/Weekly-Challenge/Challenge-146-SANTALYTICS-2018-Part-2/td-p/343664/page/PAGE_NUMBER?page_size=100000
12998
URL for Challenge 146
With Page Number
URL
String
65001
GET
Compose
2
600
Get the data for Challenge 146
(last page)
C:\Users\pasccout\AppData\Local\Temp\Engine_9956_32237eed958c43fb92d52d559211b3f3_\Engine_13104_b96bfbfe55a741cc9f30e8b17fc7edd8_.yxdb
Single
Profile
Give it a higher number than the number of pages
Get the real last page
Location = FindString([DownloadData], "- Page")
Rest of String = SubString([Down...
URL
PageNumber
Int32
4
1
PageNumber < MaxPageNumber
PageNumber + 1
Create page numbers up to the max page number
Error
Set the page number in the URL
URL
String
65001
GET
Compose
2
600
Get the data for Challenge 146
(other pages)
Only keep downloaded data and page number
Only keep downloaded data and page number
Warning
All
ByName
Get all pages
DownloadData
Split into lines
Contains([DownloadData], "lia-link-navigation")
And
Contains([DownloadData], "download=") And
(Contains([DownloadData], "yxmd") Or
Contains([DownloadData], "yxzp")) And
!Contains([DownloadData], ToString([Thread Number],0))
Custom
=
True
fixed
2018-12-19 07:34:18
0
2018-12-19 07:34:18
2018-12-19 07:34:18
Search for download lines containing yxzp or yzmd
Skip items related to the post that created the thread
Contains([DownloadData], "lia-link-navigation")
And
Contains([DownloadData], "d...
Calculate number of solutions
Horizontal
challenge_146_my_solution