Forum FlexPro – Discuss your topic!

"Active" diagram when worksheet not open

Accueil > Community > FPScript > "Active" diagram when worksheet not open

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #12541

    I have written the following code in FPScript to integrate a flow signal to allow volume calibration. The first two marks indicate a segment of the file with no flow, in order to remove any offset in the signal, and then three “pumps” with a calibrated syringe are integrated, and the results returned. The problem I have is that if the WorkSheet is not open, there is no “Active” diagram, so “Marks=WorkSheet.WKS.MarksIndexX(0)” returns an empty set. This occurs even if the proper folder is active.

    Any suggestions?

    Thanks,

    Paul Warshawsky

    Dim Marks,Offset,V1,V2,V3,V4,V5,V6
    Marks=WorkSheet.WKS.MarksIndexX(0)
    Marks=Sort(Marks,SORT_X)
    Offset=Average(c04[Marks[0],Marks[1]])
    V1=(Integral(c04[Marks[1],Marks[2]]-Offset))[Marks[2]-Marks[1]]
    V2=(Integral(c04[Marks[2],Marks[3]]-Offset))[Marks[3]-Marks[2]]
    V3=(Integral(c04[Marks[3],Marks[4]]-Offset))[Marks[4]-Marks[3]]
    V4=(Integral(c04[Marks[4],Marks[5]]-Offset))[Marks[5]-Marks[4]]

    V5=(Integral(c04[Marks[5],Marks[6]]-Offset))[Marks[6]-Marks[5]]

    V6=(Integral(c04[Marks[6],Marks[7]]-Offset))[Marks[7]-Marks[6]]
    Return({3/((V1+V3+V5-V2-V4-V6)/6), V1, V3, V5, V2, V4, V6})

    #8204

    I have written the following code in FPScript to integrate a flow signal to allow volume calibration. The first two marks indicate a segment of the file with no flow, in order to remove any offset in the signal, and then three “pumps” with a calibrated syringe are integrated, and the results returned. The problem I have is that if the WorkSheet is not open, there is no “Active” diagram, so “Marks=WorkSheet.WKS.MarksIndexX(0)” returns an empty set. This occurs even if the proper folder is active.

    Any suggestions?

    Thanks,

    Paul Warshawsky

    Dim Marks,Offset,V1,V2,V3,V4,V5,V6
    Marks=WorkSheet.WKS.MarksIndexX(0)
    Marks=Sort(Marks,SORT_X)
    Offset=Average(c04[Marks[0],Marks[1]])
    V1=(Integral(c04[Marks[1],Marks[2]]-Offset))[Marks[2]-Marks[1]]
    V2=(Integral(c04[Marks[2],Marks[3]]-Offset))[Marks[3]-Marks[2]]
    V3=(Integral(c04[Marks[3],Marks[4]]-Offset))[Marks[4]-Marks[3]]
    V4=(Integral(c04[Marks[4],Marks[5]]-Offset))[Marks[5]-Marks[4]]

    V5=(Integral(c04[Marks[5],Marks[6]]-Offset))[Marks[6]-Marks[5]]

    V6=(Integral(c04[Marks[6],Marks[7]]-Offset))[Marks[7]-Marks[6]]
    Return({3/((V1+V3+V5-V2-V4-V6)/6), V1, V3, V5, V2, V4, V6})

    #8874
    Bernhard KantzBernhard Kantz
    Participant

    Accessing the marks or cursors of a diagram in a worksheet or document is currently only possible if the worksheet or document is opened. In case of a document, the cursors have to be enabled too.

    When accessing the marks, this restriction seems to be not necessary and we will try to find a way to remove it.

    Until we change that behaviour, you need to open the worksheet for your formula to work properly. Maybe you can write a VBA event handler to automatically open the worksheet(s) when you open your database.

    support@weisang.com

    #8875
    Bernhard KantzBernhard Kantz
    Participant

    This problem has been solved in FlexPro 7. You can now access the cursors in a closed worksheet.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.