Solved

Query a list and display it to add information

  • 19 September 2023
  • 2 replies
  • 175 views

Badge +3

Hi all, 

I have been trying to follow some previous articles (namely @jesse_mchargue’s Queries, and Collections, and Loops, Oh My!) because it seems to be explaining somewhat what I want to achieve, but with the broken images, it is making it a bit difficult for a newbie like myself!

I currently have a form which asks a user to submit payments against a reservation. I have used a repeating section to allow the user to submit more than one payment.

I was able to loop and add that data to a Sharepoint list where each ‘transaction’ is a new row (thanks to the advise of @brandiwoodson).

The second part of my solution (and the bit that I fear wont be possible) to the issue I am trying to resolve, is for a different user at the end of the day to go into another form, query all the transactions that were submitted on that day in the particular station, then add an authorisation code. Similar to the mockup-below 

The authorisation code will then be added to the relevant row in Sharepoint. This will then be used for the reconciliation of the payments against the accounts.

I have tried a few things (query SP list, retrieve an item, loop for each) but I don’t know how I am able to have it display each row in a way that I am able to see the information and add more information to the row.

I hope this all makes sense (and is possible!)

icon

Best answer by Jake 26 September 2023, 11:52

View original

2 replies

Userlevel 5
Badge +13

Hi @ItsGavin 
 

This should be possible but we need to do some steps to make it work.

 

When you create the record to store the repeating data, instead of storing them in separate records I would use a single item that has its own repeating section inside, that repeating data is stored in a multi-line text field as XML.

 

The issue comes when repeating data in NAC is stored as JSON and that needs to be translated into the XML of the repeating section on SharePoint.

 

To do that I would create the SharePoint form first and add dummy data into the repeating section so I can get the XML structure, Remove the dummy data and you should be left with the XML template you can use to create/update it.

In NAC you can use a loop and build a string actions to populate the body of the XML (keeping the header and footers in another variable/build string action)

Once your loop completes you combine the header/body/footer text and store that in the multiline text field the repeating section is attached to, on the form it will then display correctly and will be editable.

 

On another note, we are working on making repeating sections editable at the moment so this becomes much more simple in the future. 
Jake

Userlevel 5
Badge +13

To go into more detail here is an example below (your XML will likely be very different):

Dummy data:

<RepeatingData>
<Section>
<Name>John Doe</Name>
<Age>30</Age>
<Email>johndoe@example.com</Email>
</Section>
<Section>
<Name>Jane Smith</Name>
<Age>25</Age>
<Email>janesmith@example.com</Email>
</Section>
<Section>
<Name>Bob Johnson</Name>
<Age>40</Age>
<Email>bobjohnson@example.com</Email>
</Section>
</RepeatingData>

Template:

<RepeatingData> <!-- Header -->
<!-- Body -->
<Section>
<Name></Name>
<Age></Age>
<Email></Email>
</Section>
<!-- Body -->
</RepeatingData> <!-- Footer -->

Store the header and footer parts in different variables

in the loop for each repeating section item you would have a build a string action with the following:
 

<Section>
<Name>[name variable]</Name>
<Age>[age variable]</Age>
<Email>[email variable]</Email>
</Section>

At the end you combine the header > Body > Footer together and it will build the structure again.

Reply