Hello,
I'm trying to create an app with live data from a feature layer in my portal. On Power Automate I'm able to test the connection and use ArcgisEnterprise.Getdatafromfeturelayer to fetch data, so I know the connector and the feature layer is accessible.
As for PowerApps I only have the deprecated version of the function (getfeaturelayerdata) which doesn't work.
I am doing something similar right now. I'm not visualizing points, just data. But it is working.
I found running a similar flow in Power Automate before creating the PowerApp was best. If you inspect the Power Automate run, it gives you everything that PowerApps is expecting to see.
I just did a proof of concept this week, and likely am not going to do anything serious with this app until January now. But I can at least share what I have so far.
In the app's OnStart property:
// 1) Call ArcGIS connector
Set(
varProjectsJson,
ArcGISEnterprise.GetFeatureLayerData(
"My content",
"<URL>", //If you're unsure what this URL should be, you should first run a flow in Power Automate using the same connector. Inspect the flow and you will see the full URL needed
"JSON",
{
returnGeometry: false, //true if you want point data. I haven't tried this yet.
where: "1=1",
outFields: "*", //I'm lazy and grab everything.
startingCount: 0
}
)
);
// 2) Normalize to text, then parse to untyped objects. May not be needed. I had may issues with this and have yet to optimize the workflow
Set(
varText,
JSON( varProjectsJson, JSONFormat.IncludeBinaryData ) // guarantees Text for ParseJSON()
);
// 3) Coalesce the possible outcomes. Same as step #2. This shouldn't be needed, but optimization will come later.
With(
{
rows:
Coalesce(
ParseJSON(varText).body.data,
ParseJSON(varText).data,
ParseJSON(varText)
)
}, //Create the collection for use in gallery
ClearCollect(
colProjects,
ForAll(
rows, //customize rows and also set type. The names, like "ProjectName" are internal and can be anything (avoid spaces and special characters). The things after "attributes" are specific to your data.
{
ProjectName: Text(ThisRecord.attributes.prname),
ProjectLongName: Text(ThisRecord.attributes.prlongname),
PM: Text(ThisRecord.attributes.pm),
PM_Email: Text(ThisRecord.attributes.pm_email),
Province: Text(ThisRecord.attributes.custlocation_province),
City: Text(ThisRecord.attributes.custlocation_city),
Address: Text(ThisRecord.attributes.custlocation_addressline1),
PostalCode: Text(ThisRecord.attributes.primarypostalcode),
Status: Text(ThisRecord.attributes.status),
ProjectNumber: Text(ThisRecord.attributes.wbs1),
ObjectID: Value(ThisRecord.attributes.objectid)
}
)
)
);
In my Canvas app, I have a Text Input (txtSearchWBS1) and a Gallery (galProjects).
For the Gallery's Items, I use this formula. All I'm doing is using the Text Input to filter my data based on ProjectNumber. If the Text Input is blank or the user enters less than 5 characters, the Gallery is blank.
With(
{s: Trim(txtSearchWBS1.Value)},
If(
Or(IsBlank(s),Len(s)<5),
Filter(
colProjects,
false
),
Filter(
colProjects,
StartsWith(
Upper(ProjectNumber),
Upper(s)
)
)
)
)
And that's it. End result is a PowerApp that queries a Feature Layer.