Link project to itself for using and displaying data collected on same form

Hello all,

Basically i would like to know how can i link a project to itself to use, calculate and display data collected on that same form.

For example im building a form to collect user data, and i want to validate if user exists or not to create a new user or modify existing user information.

Is there a way to do this using dynamic data attachment? ( i read the documentation but no examples on this particular case, i only see it connecting a parent to a child project) or is there any different approach for doing this?

Hi!

This is definitely possible, bearing in mind the small delay needed to update the data that’s linked. As linking to a form requires that form to have some data submitted, linking a form to itself is a 2-step process. First create the form without any logic referencing itself - below is a super lightweight example.

Demo Self-reference initial.xlsx (10.5 KB)

Then upload at least one submission (even if with dummy data that you delete later), and after it’s uploaded, change the settings to set data sharing as enabled, and then select the form itself from the drop-down in ‘import other project data’ (all in the ‘connect projects’ page).

Now you should be able to add the logic where the form references itself. Below is the updated lightweight example that checks whether 1 or more records already exist with the user-inputted user ID.

Demo Self-reference with logic.xlsx (10.7 KB)

Hope this helps!

2 Likes

@amschel, :clap: :heart: :partying_face:

@amschel You are the best! i will definitely try that on my form logic, Thank you for that amazing explanation and the example provided. Cheers!

1 Like

I tried following the solution step by step but I am unable to implement it. Please help with this. @Kal_Lam @amschel

I am trying to check if the email address and phone number both are new or is already present in the submissions done before.

Hi, at what step are you running into issues? And what is the structure of the form you’re trying to create?

1 Like

For those having issues with this solution, just adding some follow-up clarifications:

Make sure that when you first upload the file, that it does not have any of the following (what I referred to in my earlier solution as ‘logic referencing itself’):

  • xml_external type questions
  • calculations or other fields with instance('<form-name>)/root/data... logic

Then once you have followed the steps in the solution above, you can then re-add these elements to your form

It doesnot work , Sorry
I’ve been trying for hours. The same steps as you explained.

Hi, no worries - can you give me more information as to what you’ve tried, and what error messages are shown? Also if you’re able to upload an XLSform that would help

Hi
Thank you for your response

I used the same files you shared , and the
same steps . It doesn’t work.

I’m sorry, I don’t think I can give you any more help without knowing more about what is going wrong when you try the solution.

If you can provide more detail, any screenshots, steps taken, error messages the system showed, then I can see if I can work out what’s going wrong.

Say I want to check if a phone number has already been used in a survey and immediately flag that as data collection proceeds. Do I have to send the previous survey first so that the contact is in the database or is there a logic to check this even if the previous form is not synched?