Home
TeamSite
TeamSite, LiveSite and OpenDeploy
Replicants and inline PERL scripts
System
I desperately need to be able to get an INLINE script to run every time an "add replicant" (+) button is clicked. The reason is that I want to generate a unique number for each replicant (these will become list items to be written to a database). At the moment the script only seems to run once: subsequent unique numbers (constructed from date and time) are exactly the same!
Any help gratefully received.
Find more posts tagged with
livesite
opendeploy
Comments
sjpfist
Ian,
I don't think there is a way to accurately do what you want to do. Pretty much once the server hands off a DCR to the client it is done. Core operations such as save, save as, and callouts are the only way to communicate back to the server.
Now, what I would do is this... I would generate a unique number for the first replicant and still have that number apply to all other replicants (well, you have to anyways). In your presentation layer, I would then process the replicant and generate unique ID's there for each replicant item.
It's not the best solution because you have to somehow ensure uniqueness if the ID's come out of order, but it should be a good start to get you going.
Steve
Denise Bowker
I'm assuming you need to have this field used to uniquely identify the record in your database to be used as part of a unique key/index.
Can you have the database automatically fill in the number? Access calls them AutoNumbers, Sybase calls them Idents (I think). That would help with the uniqueness in the database.
If you are trying to have a unique number, or sequential number when the Presentation template is applied, you can use the 'iteration=xyz' option on the iw_iterate tag and refer to it later as $xyz. The issue I had was it was zero based, so I needed $xyz+1in the PT. I used this for creating forms and people wanted 'question numbers' to be automatically inserted.
Good Luck
Dan Bowker
Migrateduser
Thanks for your thoughts and advice. Interwoven have now made this a feature request, due to form part of a spring release of TS.
In the meantime, we'll probably be running some code from our workflow to fill in missing UIDs on the DCR: nomatter which way we look at the problem we come to the conclusion that the DCR has to contain the information.
Thanks again and have a great Christmas!
Ian