Need help with script/calculation

  • Follow


Here's the goal: Assume a layout with multiple fields. Go to the first 
field, extract both the contents of a field and the field name, concatenate 
the resulting text strings, paste that info in another field (call it 
concatenatedText), go to the next field on the layout, and so forth, always 
adding to the final concatenated string in concatenatedText. I can do the 
Looping with a counter, the moving from one field to the next, etc. But I am 
having trouble figuring out how to get the Get (ActiveFieldName) and Get 
(ActiveField Contents) functions to work properly in the necessary script. 
Anyone have experience with a similar problem? Any help appreciated. 


0
Reply David 12/12/2005 4:49:20 AM

What problems are you having?  Can you post what you've got so far?

-G

0
Reply Grip 12/12/2005 6:24:42 AM


I have a table with 60 fields in it (call them field1, field2, etc.) These 
are all number fields. The field names are important to what I want to do. 
Let's call the field names fieldName1, fieldName 2, etc. I need to extract 
the field name and field contents, but only from fields which are not empty. 
The resultant information needs to go into a different field which we'll 
call concatenatedText. The final contents of concatenatedText should look 
something like this: "fieldName1: field1, fieldName5: field5, fieldName55: 
field 55" assuming that fields 1, 5 and 55 are the only fields which contain 
data.

I have a script where I loop through the fields. It looks something like 
this:

Go to Field [fieldName1]
Set Field [counter; 0]
Loop
    Set Field [counter; counter+1]
    If [Get (ActiveFieldContents)=""]
        Go to Next Field
    Else
        Copy [Select]
        Go to Field [concatenatedText]
        Paste [concatenatedText]
        Insert text [", "]
    End If
    Go to Next Field
    Exit Loop If [counter>60]
End Loop

Note that this script successfully extracts the field contents and adds it 
to concatenatedText, but when I try to use Get (ActiveFieldName) as well, it 
does not seem to work. It ends up going to concatenatedText and pastes that 
field name instead of what I want. Where can I use this function in this 
script, or is there a more elegant answer that I am missing?

Thanks for your input.


"Grip" <grip@cybermesa.com> wrote in message 
news:1134368682.725199.64560@f14g2000cwb.googlegroups.com...
> What problems are you having?  Can you post what you've got so far?
>
> -G
> 


0
Reply David 12/12/2005 12:49:37 PM

David Abrams wrote:

> I have a table with 60 fields in it (call them field1, field2, etc.) These
> are all number fields. The field names are important to what I want to do.
> Let's call the field names fieldName1, fieldName 2, etc. I need to extract
> the field name and field contents, but only from fields which are not empty.
> The resultant information needs to go into a different field which we'll
> call concatenatedText. The final contents of concatenatedText should look
> something like this: "fieldName1: field1, fieldName5: field5, fieldName55:
> field 55" assuming that fields 1, 5 and 55 are the only fields which contain
> data.
> 
> I have a script where I loop through the fields. It looks something like
> this:
> 
> Go to Field [fieldName1]
> Set Field [counter; 0]
> Loop
>     Set Field [counter; counter+1]
>     If [Get (ActiveFieldContents)=""]
>         Go to Next Field
>     Else
>         Copy [Select]
>         Go to Field [concatenatedText]
>         Paste [concatenatedText]
>         Insert text [", "]
>     End If
>     Go to Next Field
>     Exit Loop If [counter>60]
> End Loop
> 
> Note that this script successfully extracts the field contents and adds it
> to concatenatedText, but when I try to use Get (ActiveFieldName) as well, it
> does not seem to work. It ends up going to concatenatedText and pastes that
> field name instead of what I want. Where can I use this function in this
> script, or is there a more elegant answer that I am missing?


My question is, of course *why* you are doing this - what are you trying
to achieve?


Otherwise, I would recommend 

>    Else

          SetField globalFieldName=Get(ActiveFieldName)

>         Copy [Select]
>         Go to Field [concatenatedText]

          InsertText [concatenatedText; globalFieldName]

>         Paste [concatenatedText]
>         Insert text [", "]
>     End If


Catja
0
Reply usenet 12/12/2005 5:55:46 PM

I personally don't like Copy and Paste and Insert.
What about a calculation field concantatedText that looks like

=If(Field1 (not=) ""; "Field1:" & Field1) & If(Field2 etc.

or a script along the principle of Set Field

Go to Field [fieldName1]
Set Field [counter; 0]
Loop
    Set Field [counter; counter+1]
    If [Get (ActiveFieldContents)=""]
        Go to Next Field
    Else Set Field [concText] = [concText & Get(ActiveFieldName)&":"&
Get(ActiveFieldContents)
     End If
    Go to Next Field 
    Exit Loop If [counter>60] 
End Loop 
 


-G

0
Reply Grip 12/12/2005 6:18:10 PM

I am trying to create a solution to keep track of heart angiograms using CT 
technology. I want to be able (among other things) correlate the findings 
obtained with CT with those of conventional invasive amgiography. The 
solution includes tables for CT and for Angio. The entire coronary artery 
tree may be divided into 60 separate segments (one field for each segment in 
each of the two tables). Each of these fields is a number field to show 
percent narrowing in the artery in that segment. The fields are named for 
the vessel segments (e.g. proximal LAD, mid circumflex, etc.) I want to 
query each nonempty field, extract the field name and the field contents, 
then paste or enter that info into another field which will be readable for 
reporting purposes (e.g. proximal LAD: 50% narrowed; mid circumflex: 25% 
narrowed, etc.).

Hope that makes sense.


"Catja Pafort" <usenet@greenknight.org.uk.invalid> wrote in message 
news:1h7guh6.1f4czwci0ppmoN%usenet@greenknight.org.uk.invalid...
>
>
> My question is, of course *why* you are doing this - what are you trying
> to achieve?
>
>
> Otherwise, I would recommend
>
>>    Else
>
>          SetField globalFieldName=Get(ActiveFieldName)
>
>>         Copy [Select]
>>         Go to Field [concatenatedText]
>
>          InsertText [concatenatedText; globalFieldName]
>
>>         Paste [concatenatedText]
>>         Insert text [", "]
>>     End If
>
>
> Catja 


0
Reply David 12/13/2005 1:04:11 AM

You might also write your script as:

Commit Record
Go to Next Field
Set Field STARTFIELD to Get(ActiveFieldName)
Loop
   Set Field RESULT to RESULT &
           If(IsEmpty(Get(ActiveFieldContents)), "",
           Get(ActiveFieldName) & ":" & Get(ActiveFieldContents) & ",
")
   Go to Next Field
   Exit Loop If Exact(Get(ActiveFieldName), STARTFIELD)
End Loop

0
Reply FP 12/13/2005 2:22:41 AM

6 Replies
250 Views

(page loaded in 0.086 seconds)

Similiar Articles:













7/19/2012 3:37:26 PM


Reply: