Store Username as a Static Value

1523
23
07-15-2019 02:02 PM
joerodmey
MVP Alum

I want to capture the username at specific times (Ex: when a user clicks a radio button) but it appears the username is always captured regardless of if its in a relavant based on a radio button. I also cant store it in a variable without it changing.

Any ideas?

thanks

0 Kudos
23 Replies
joerodmey
MVP Alum

Hi Mike Bruening

I applied your changes and still changes the text in the user_storage field to the current user. This field is set to text type right now...does that have a factor?

Thanks

0 Kudos
joerodmey
MVP Alum

Changing it to hidden didn't do anything. Still changes to the current user on submission of the survey

0 Kudos
by Anonymous User
Not applicable

Joe, did you apply this to the "Calculation" for the field? 

once(if(${Request_Status}='In_Progress',once(${user_status}),"))

Give that a try and see if that will work.

0 Kudos
joerodmey
MVP Alum

Yes I placed it in the calculation field. I did have to alter the last portion of the code because it gave me an error...had to change the " symbol to 2 '' symbol

Still doesn't work. Still pulls the current user

0 Kudos
by Anonymous User
Not applicable

Which version of the Survey123 app are you using currently? I think the issue might be is that I am developing this on the "BETA" version 3.6.53 that is available within the Survey 123 Early Adopter program. However, I just tried it on the latest version available within 3.5.154.

This is how I have the forms setup and the calculation works within the latest publicly available version for download and the BETA version. If you are not running the latest version, then maybe try updating to it and see if this works. Sorry for the delay in responses.

0 Kudos
joerodmey
MVP Alum

Hi Mike I'm running version 3.0.128 of Connect and my users are accessing the web app of Survey123.

Would 2 different session of Survey123 have an impact? By this I mean that my editing users are not really editing the data but rather clicking on a link in a map which passes the data via URL scheme to a different survey mapped to the same variables. Upon submission of this 2nd survey REST runs in the background to push the changes to the initial feature service. If separate users open up the same physical point on the webmap (at different times) I would consider this 2 session in Survey123 web form. Would the once() function not recognize this because the user are separate so the function runs twice?

0 Kudos
by Anonymous User
Not applicable

Joe,

The version of Survey123 that you are using is extremely outdated and I would consider updating to the newest version. Unless you are tied to this version for some reason. I would maybe update one device and do some testing to ensure that it doesn't break certain things within your survey.

I do not use the web app form, but instead we rely mostly on the Survey123 app itself for our data needs. I am unsure if the Survey123 "web form" supports this functionality as there are differences in what the two separate applications support. I do know that in some areas the Survey123 stand alone app excels and in other areas the webform excels. 

One other thing that would need to be clarified is are you using Collector in conjunction with this or are you using the Custom URL Schema within a note question to pass the data between Survey123 "Field App" forms or is the data being passed into a Survey123 "Web Form". If all of your devices have the version mentioned above installed on them, then this is why you are not seeing the "calculation" being supported within your forms; as it is many versions behind the currently supported version.

0 Kudos
joerodmey
MVP Alum

I have purposely not updated to maintain the current flow that I have built. As for the way I'm passing data, I'm using the custom URL schema and passing the data via a custom popup in a webmap, not in Collector. The data is then populated in the 2nd survey123 webform. My thinking is that the issue lies with the once not recognizing logins by different user at different times. The calculation field works with other formulas I have built in.

0 Kudos
by Anonymous User
Not applicable

Joe, where does the question for the "In Progress" occur; within the field app or within the Survey123 webform? If it is within the field app, then I do not believe there is a way around this. 

I really believe it is within the version of the Survey123 field application's coding/programming and how the Survey123 team is handling the different functions. They are constantly making updates and changes to the field app to utilize what they are making available with each new releases and it is not backwards compatible. The workflow that you describe still would be supported within the newest version of the Survey123 application in conjunction with passing data through a custom URL. I am guessing that there are some other functions or items that you have set up within the form that have been altered by the progression of the field app?

I think by not exploring and doing some research and development to update your workflow to the latest release, that you will just be frustrated with the attempts to get things to work. The difference between the version you are using and the most current version is night and day. Kind of like flip phones vs. a new Google Pixel or iPhone. I have continuously made adjustments and redesigns to leverage the most current release; at times I questioned myself as to why I would do it when things were working to a satisfactory level, but in the end it has always been worthwhile. 

Have you looked into webhooks at all and whether they could help you with this current workflow? I currently have a setup that uses two hosted features services, one Survey123 form, and a webhook that uses the REST API. The webhook will listen for the Survey123 form submittal and then take some of the information from the Survey123 form being submitted to Survey123 Hosted Feature Service and apply "updates" via REST to a second Non-related Survey123 Hosted Feature Service. It kind of sounds like something similar to what you are doing.

I wish you the best in figuring out a solution that will work for you. If you would want any help exploring webhooks, then let me know. I have received a lot of outside help and wouldn't mind helping you out if you are interested.

0 Kudos
joerodmey
MVP Alum

All of my work within Survey123 occurs in the webform. I never use the field app in this workflow.

I will explore upgrading my version of connect after some testing.

Yes I use webhooks. The workflow you describe is very similar to my workflow. In my I have 2 feature services created from Survey123 connect and there is the main data where everything, and my "edit" survey that pushed everything via REST and webhooks to the main feature service. The data gets from the first survey to the second one via the custom URL scheme and a web map popup. The "edit" survey is where the user would set the status to in progress. So basically in my case I want the user who logs into the "edit" survey to have their username captured only once when they set the status to in progress and when a second different user logs in and wants to set the status to in progress on the same feature service point, the comparison between stored username (locked in place with the once function) and the current username of the user logged in.

Hope that helps in understanding my flow Mike Bruening

0 Kudos