|
POST
|
That code should work. Did you check whether you're getting any valid related records? It would be something like this (untested) var portal = Portal("https://gis.clark.wa.gov/portalpw/");
var Stmdocs = FeatureSetByPortalItem(portal, "4b35b095430d47d699dea875e62dd0b6", 3, ["MmsId", "FilePath"]); //42 is the table ID in the service
// Filter related features by using a common attribute
// Here both table have identical MMSID fields
var MMSID = $feature.MmsId;
var filterStatement = "MMSID = @MMSID";
// Related features as a variable
var relatedData = Filter(Stmdocs, filterStatement);
var output = 'No images found'
if (Count(relatedData) > 0) {
// Sort related features by oldest to newest
var relatedDataSorted = OrderBy(relatedData, "MmsId");
// Build the pop-up string by iterating through all related features ideally as hyperlinks
var thenewpath = "";
var theurl = "";
var list = [];
for (var f in relatedDataSorted) {
thenewpath = Replace(f.filepath, "olympus", "");
thenewpath = Replace(thenewpath, "gisdata", "");
thenewpath = Replace(thenewpath, "Images", "ccimages");
thenewpath = Replace(thenewpath, "\\", "/");
thenewpath = Replace(thenewpath, "////", "https://gis.clark.wa.gov/");
theurl = `<a href="${thenewpath}">Image</a>`;
Push(list, theurl);
}
output = `<b>Image Links:</b> ${Concatenate(list, TextFormatting.NewLine)}`;
}
return {
type: "text",
text: output
};
... View more
07-29-2024
07:09 AM
|
0
|
12
|
4797
|
|
POST
|
I found it almost impossible to figure out how to extract the days and times logically in an Arcade script. The only thing I could come up with it to have a string field (LocationHoursByDay) with each day's time span or closed in a concatenated list, where "M - Tr 9:30 AM - 8 PM, F 9:30 AM - 6:30 PM, Sa - 10 AM - 3:30 PM, Su 11 AM - 3:30 PM" would be represented as "9:30-20, 9:30-20, 9:30-20, 9:30-20, 9:30-18:30, 10-15:30, 11-15:30" while the line "M,W,F 8:30 AM - 11 AM" would be "8:30-11, closed, 8:30-11, closed, 8:30-11, closed, closed" That field would be utilized in this script function ConvertTime(input) {
var theTime = input;
if (Find(":", theTime) > -1) {
var times = split(theTime, ":");
theTime = Number(times[0]) + Number(times[1]) / 60;
}
return Number(theTime);
}
var current = ConvertTime(Time(Now()));
var fTime = '8:30-11, closed, 8:30-11, closed, 8:30-11, closed, closed'; //$feature.LocationHoursByDay,
var times = Split(fTime, ', ')
var todaysTime = times[Weekday(Today()) - 1];
if (todaysTime == 'closed') return 'Closed'
var todaysTimes = Split(todaysTime, '-')
var start = ConvertTime(todaysTimes[0]);
var end = ConvertTime(todaysTimes[1]);
iif(current >= start && current <= end, 'Open Now', 'Closed')
... View more
07-26-2024
02:18 PM
|
1
|
2
|
5035
|
|
POST
|
The null field shouldn't be a problem, but those other values for Time are confusing. What does something like "9:30, 10, 11, 15:30, 18:30" or "9, 8, 19, 21" represent?
... View more
07-26-2024
01:06 PM
|
0
|
0
|
2014
|
|
POST
|
You have to replace the test variables with your feature like this: function ConvertTime(input) {
var theTime = input;
if (Find(":", theTime) > -1) {
var times = split(theTime, ":");
theTime = Number(times[0]) + Number(times[1]) / 60;
}
iif(theTime < 6, Number(theTime) + 12, Number(theTime));
}
//var DaysOpen = "Th, F";
//var fTime = "8, 2";
var days_abbr = ["Su", "M", "Tu", "W", "Th", "F", "Sa"];
var weekday = Weekday(Today());
var timeofday = Time(Now());
var current = hour(timeofday) + (minute(timeofday)/60);
var opening = Split($feature.Time, ",");
var start = ConvertTime(opening[0]);
var end = ConvertTime(opening[1]);
if (Find(days_abbr[weekday], $feature.DaysOpen, 0) != -1 && (current >= start && current <= end)) {
return "Open Now";
} else {
return "Closed";
} What are the earliest and latest times?
... View more
07-26-2024
12:21 PM
|
0
|
1
|
3117
|
|
POST
|
OK, that made it a bit tougher. Here's my solution, with one big assumption. I assumed that there wouldn't be any openings/closings before 6 am or after 6 pm (line 7) to convert it to a 24 hour time. I used the dummy variables "DaysOpen" and "fTime" for testing, which you can replace with your fields. function ConvertTime(input) {
var theTime = input;
if (Find(":", theTime) > -1) {
var times = split(theTime, ":");
theTime = Number(times[0]) + Number(times[1]) / 60;
}
iif(theTime < 6, Number(theTime) + 12, Number(theTime));
}
var DaysOpen = "Th, F";
var fTime = "8, 2";
var days_abbr = ["Su", "M", "Tu", "W", "Th", "F", "Sa"];
var weekday = Weekday(Today());
var timeofday = Time(Now());
var current = hour(timeofday) + (minute(timeofday)/60);
var opening = Split(fTime, ",");
var start = ConvertTime(opening[0]);
var end = ConvertTime(opening[1]);
if (Find(days_abbr[weekday], DaysOpen, 0) != -1 && (current >= start && current <= end)) {
return "Open Now";
} else {
return "Closed";
}
... View more
07-26-2024
10:03 AM
|
0
|
3
|
3137
|
|
POST
|
What type of field is "Time": a date field, a string field, or a numeric field? What type of values does it contain?
... View more
07-26-2024
08:33 AM
|
0
|
7
|
3160
|
|
POST
|
That's curious, since it worked in my testing. I created a new date field, copied an existing field's dates into the records, then set them to null again. The screen image was the last step in my process.
... View more
07-26-2024
06:48 AM
|
0
|
0
|
8247
|
|
POST
|
Even though you do get that warning, the date values are calculated to null.
... View more
07-25-2024
12:00 PM
|
0
|
3
|
8310
|
|
POST
|
Could you post your code to see what's on line 9? I'm wondering if there's a null geometry in your data. I tested this on the USA States and USA Major Cities dataset from the Living Atlas and didn't get any errors.
... View more
07-25-2024
09:45 AM
|
0
|
1
|
2627
|
|
POST
|
My apologies...I had the syntax incorrect. Give this a try (using your own layer and field names) var intersectLayer = OrderBy(
Intersects(
FeatureSetByName($map, "other layer"),
Buffer($feature, -1, "feet")
),
"sortField DESC"
);
var results = [];
for (var f in intersectLayer) {
results[Count(results)] = f["displayField"];
}
var output = Concatenate(results, ", ");
... View more
07-24-2024
01:36 PM
|
1
|
3
|
2634
|
|
POST
|
I've also gone the route of altering my data to get the correct symbology before reverting it back to its original state. I'll look forward to that code you provide!
... View more
07-23-2024
03:46 PM
|
0
|
0
|
1570
|
|
POST
|
Could you use the Vector Tile Style Editor to modify the symbology of an existing basemap?
... View more
07-23-2024
11:26 AM
|
1
|
0
|
1487
|
|
POST
|
The code I posted initially used a layer with 68K records, so that size of data shouldn't be a problem. Another way to cut down on the request is not to return the geometry of the features. I'm curious on what result you got when doing a test run vs. getting the error in the Dashboard
... View more
07-23-2024
10:31 AM
|
0
|
1
|
2213
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-04-2025 06:39 AM | |
| 1 | 05-01-2026 08:26 AM | |
| 1 | 04-10-2026 12:01 PM | |
| 1 | 04-13-2026 09:11 AM | |
| 1 | 10-11-2023 06:18 AM |
| Online Status |
Online
|
| Date Last Visited |
yesterday
|