You can create an object of an entity before opening the page and have an attribute in it. Write a logic to generate the unique code and assign it. Then open the page and use Dataview with the newly created object as Dataview source. You can also do this with Microflow but not advisable.
Hope this answers your query.
Sharad R K