attribute rule calculate twice on webappbuilder

492
3
04-01-2023 10:42 AM
solidsnake
New Contributor II

Hello,

i have a probleme in my web appbluider application when creating new record for features or related tables with attributes rules immediate calculation, the problem that it's execute the rule twice 

 

i did the folowing step

  1. create table/features in geodatabase 
  2. add attribute rules that calculate an ID field by incrementing the ID like that (URB00001, URB00002...) +1 for each new records
  3. I publish it as features services with referenced database
  4. i created the map object and then the web application with web appbuilder
  5. i add edit widget and there i got the probleme when editing (adding new record)

when i create record in arcgis pro evrything work perfectly for each record i create the ID increment by +1, but when i use the edit widget in web app builder its like the attribute rule is executing twice (URB00002, URB00004, URB00006....) +2 for each new record.

i also observed that the object id is not regular between arcgis pro and web appbuilder for exemple in arcgis pro it increment fine (1,2,3...) but in web appbuilder it go (400,401,402..)

i use Arcgis Enterprise 10.7.1 and arcgis pro 3.0.1

thanks for you help.

3 Replies
Omar_A
by Esri Contributor
Esri Contributor

Hi, 

I think this could be due to the fact that the feature service is being edited by two different processes at the same time, such as a web app and a mobile app, and each process triggers the attribute rule execution. To avoid this, you can configure the feature service to allow only one simultaneous edit session at a time, by setting the 'Maximum number of instances per machine' parameter to 1 in the 'Capabilities' tab of the feature service's properties in ArcGIS Server Manager.

Look at these posts for more details:

How to determine the number of min\max instances (... - Esri Community

Maximum number of instances per machine - Esri Community

Regarding the irregular ObjectID values, this is expected behavior in a multi-user environment, where different editors may be creating new features at the same time. To ensure unique ObjectIDs, ArcGIS Server assigns blocks of ObjectIDs to each server instance, and these blocks may not be sequential across instances. However, you can still use the attribute rule to generate unique IDs based on another field, such as the creation date/time or a sequential number generated by the rule itself, rather than relying on the ObjectID.

Best,

Omar

0 Kudos
solidsnake
New Contributor II

Hi Mr  @Omar_A 

Thank you for your answer

For your suggestion to “ allow only one simultaneous” I did try it but it didn’t fix the problem

cap0003.PNG

What I did then is I added à trigger quickly (thank to chat gpt) to the postgresql database and I deactivated the attribute rule. as a result : in Arcgis Pro (through editing geodatabase)  and pgadmin it worked, but in web appbuilder it didn’t trigger.

Same thing happened when I tried to edit the features services directly from Arcgis Pro (nothing happened).

I think may be it has something to do, on how web services handle attribute rule.

Next an image of the service config.


cap0006.PNG

 

I don’t know what to next, need some help

thanks

0 Kudos
Omar_A
by Esri Contributor
Esri Contributor

Hi,

It seems like you have already tried the suggestion to limit the number of simultaneous edit sessions to 1, adding a trigger to the Postgres database and deactivating the attribute rule, which worked in ArcGIS Pro and PGAdmin, but not in Web AppBuilder or when editing the feature service directly from ArcGIS Pro. It's possible that the issue is related to how web services handle attribute rules.

One suggestion is to check if the attribute rule is published with the feature service in ArcGIS Server, and if it's not, try publishing it with the service. You can also try troubleshooting the issue by reviewing the logs in ArcGIS Server Manager to see if there are any error messages related to the attribute rule or the feature service.

I hope this can solve your problem 

Best,

Omar 

0 Kudos