![]() | |
#1
| |||
| |||
|
|
It will still go through all 20 rows looking for data before going on to the next record, but itīs really not worth complicating the script to avoid that ... unless itīs going to be run often and most of the records only use a few portal rows. |
#2
| |||
| |||
|
|
Hi Helpful Harry Just return from my summerholidays :-) I tried to implement the If sentence to avoid the empty records, however I cannot get it to work. E.g. in case of a portal with 3 rows, it copies all 3 rows to Fakturaer::Varenr1, Fakturaer::Antal1, Fakturaer::Varenr2, Fakturaer::Antal2, Fakturaer::Varenr3, Fakturaer::Antal3. However all of the rest from Fakturaer::Varenr4 to Fakturaer::Antal20 are filling in with the contents of the last row in the portal, which in this case corresponds to Fakturaer::Varenr3, Fakturaer::Antal3. It seems that the If sentence only tests the first Portal row by testing Linier:Varenr. Can Linier::Varenr be tested row by row in the portal - in the form of Linier::Varenr[2] or ..? It will still go through all 20 rows looking for data before going on to the next record, but itīs really not worth complicating the script to avoid that ... unless itīs going to be run often and most of the records only use a few portal rows. That is the case. Maybe it would be an idea to test how many rows the portal contains, if that is possible? And then only transfer the number of rows to the table (Fakturaer), which are available. Go To Record / Request / Page [First] Loop Go To Portal Row [No dialog; 1] If [not(IsEmpty(Linier::Varenr))] Set Field [Fakturaer::Varenr1; Linier::Varenr] Set Field [Fakturaer::Antal1; Linier::Antal] End if Go To Portal Row [No dialog; 2] If [not(IsEmpty(Linier::Varenr))] Set Field [Fakturaer::Varenr1; Linier::Varenr] Set Field [Fakturaer::Antal1; Linier::Antal] End if Go To Portal Row [No dialog; 3] If [not(IsEmpty(Linier::Varenr))] Set Field [Fakturaer::Varenr1; Linier::Varenr] Set Field [Fakturaer::Antal1; Linier::Antal] End if ... Go To Portal Row [No dialog; 20] If [not(IsEmpty(Linier::Varenr))] Set Field [Fakturaer::Varenr1; Linier::Varenr] Set Field [Fakturaer::Antal1; Linier::Antal] End if Go To Record / Request / Page [Next, Exit After Last] End Loop |
#3
| |||
| |||
|
|
The "Exit After Last" option will automatically cause the script to jump out of the inner loop once it hits an empty portal row (or ther are no more portal rows). |
![]() |
| Thread Tools | |
| Display Modes | |
| |