Forums › Forums › SIMPOL Programming › Iterating through form to get detailblocks
Tagged: detailblocks
- This topic has 2 replies, 2 voices, and was last updated 7 years, 5 months ago by JD Kromkowski.
- AuthorPosts
- March 23, 2017 at 4:50 pm #3486JD KromkowskiParticipant
I have a form with 4 detailblocks. I need to update a calculated fields like calculateordertotals() does in SimpolBusiness. This is easy to do if I know the detailblock in advance, I can certainly do
for example: dtb1 me.form!dtbNameOr when I edit a dtb, I can get it with an ongotfocus function attached to the editfield
dtb =@ me.formnode.key.controlsource.detailblockBut I want to be able to generically get because different dtb have different things to total.
So I want to iterate through, but I can seem to do thatThis code below “works” but I thought I should be able to use .getnext() or .getprev(), but it doesn’t seem to work, so I have this clunky thing.
How do I iterate and get just the detailblocks. I don’t really understand difference between form and formnode. Is that my problem?
dataform1detailblock dtb1, dtb2, dtb3, dtb4
dring detblocks
integer countdtb
detblocks =@ me.form.detailblocks
dtb1 =@ detblocks.head.key
dtb2 =@ detblocks.head.prev.key
dtb3 =@ detblocks.head.prev.prev.key
dtb4 =@ detblocks.head.prev.prev.prev.keyJDK
March 24, 2017 at 4:48 pm #3487MichaelKeymasterHi John,
You should be able to use something like this:
dataform1detailblock dtb dtb =@ me.form.detailblocks.getfirst() while dtb !@= .nul // ... dtb =@ dtb.formnode.getnext() end while dtb =@= me.form.detailblocks.getfirst()
March 24, 2017 at 5:15 pm #3490JD KromkowskiParticipantThanks Neil. I will take a look.
What exactly is “formnode”.
- AuthorPosts
- You must be logged in to reply to this topic.