Hi all, this is the code I am working with but I can't get past Line 3. This code worked like a charm in my old web map but I had to republish the web layers in a new map with revised schema and now it doesn't work. I've checked all the editing settings which are correct but I'm not sure how I need to fix my Playground error "$layer is not defined". Note: This relational database is in design, so no feature data yet. Basically, when the customer feature is created the CustomerID is populated and then sequenced as below. As I mentioned, it was working in the old map. I'm not sure where or what to check now and I can't find any examples of using $layer in all the resources on line. Would be very grateful for some advice on this! @bbollin
@KenBuja would you be able to point me in the direction of troubleshooting why my $layer is not defined?
Thank you, Kristal
var custID = $feature.CustomerID
var numArr = []
Console($layer)
if (IsEmpty(custID)) {
if (Count($layer)>0){
for (var row in $layer) {
//Console (row ['CustomerID'])
//return row ['CustomerID']
if (!IsEmpty(row.CustomerID)) {
var cn = Number(Split(row.CustomerID, 'C')[1])
Console("Split number = " + Text (cn))
Push(numArr, cn)
}
}
custID = "C" + Text(Max(numArr) + 1)
}
if (Count($layer)== 1) {
custID = "C1"
}
}
return custID