Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Peek() problem

The general idea was:

When user click/select one cell in Table Box do some procedure.

1. I put into Edit Script following SQL:

varStartUp:
SQL
SELECT 1 as TYP, 120 as Kod, 0.5 as DivKo1,'00' as SL,'10' as Jmf
UNION
SELECT 2 as TYP, 122 as Kod, 0.6 as DivKo1,'01' as SL,'11' as Jmf;


2. On sheet as created Table Box with all fields of "varStartUp"

3. In Document Properties / Triggers was added Action for field event "TYP" (Run Macro -> "DO_Select")

4. To Edit Module was added maro's script:

Sub DO_Select()
Let vFld = Peek('TYP',0,'varStartUp')
End Sub

When I try Debug script "DO_Select" in Edit Module I got Error message : "Expected statement " for row Let vFld = Peek('TYP',0,'varStartUp')

Any combination with qoutes get the same error!

I need get all fields values (TYP, Kod, DinKo1, SL, Jmf) for selected table row.

Could you help me resolve this issue?

7 Replies
sparur
Specialist II
Specialist II

Hello, I don't sure that you can to use a standard QV function (such as peek()) in Module script. In Module Script we can to use only standard API function (see in APIguide.qvw) and function VB/Java Script.

Not applicable
Author

Hmmmm... Well...

And how I can get field values from Table Box after user made selection one of rows?

----

? ??? ?????, ??? ?? ???????, ??????? ?????????? ?????? ?? ????????

??? ???? ???????? ??? ???????? ????? ?? ?????? Table Box , ??????? ?????? ????.

?.?. ?? ??????? ?? ?????-???? ?????? Table Box, ? ????????? ?????? ??????????????????? ?????????? ?????????? ?????????? ?? ????????? ??????Table Box?.

??? ??? ????????

sparur
Specialist II
Specialist II

You should to see in APIguide.qvw. and find some functions, which help you. For example, function GetSelectedValues:

sub LogFunktion
'This routine logs selection to a text file

set fso = CreateObject("Scripting.FileSystemObject")
set mypath = ActiveDocument.GetProperties
directory = mypath.MyWorkingDirectory

On Error Resume Next
' See if file already exists.
Set filFile = fso.GetFile(directory & "log.txt")
' If not, then create it.
If Err <> 0 Then
Set filFile = fso.CreateTextFile(directory & "log.txt")
End If

Set txsStream = filFile.OpenAsTextStream(8) 'For Appending

set doc = ActiveDocument
set mySelections = doc.fields("Field").GetSelectedValues

for i = 0 to mySelections.Count - 1
txsStream.WriteLine Now & " " & mySelections.Item(i).text
next
txsStream.WriteBlankLines 1
txsStream.Close

end sub

----

??, ? ??????? Smile.

? ??? ????? ???? ???? ????????? ??? ?????????? ?? ?????? ?????, ???????? ? TableBox, ?????????? ???? ???, ?? ?????????? ???????? ????????? ????? ??? ?????? ??????? ????, ? ?? ????????? ????? ?????????? ??????? GetPossibleValues (?????? ????????????? ??????? ? ????????????)...

Not applicable
Author

Thanks! I'll try and feedback.

Not applicable
Author

I have additional question concerning my main question above.

I have found one interesting function: GetSheetObject()

set Obj = ActiveDocument.GetSheetObject("tbStartUpVar")

Could I reach the selected item in Table Box if I will use "Obj"?

Please explain me this approach.

---

? ????? ??????? ????? ?????? ?????? ?? ??????????? ??????????? ???????? ? Table Box - GetSheetObject()

??? ????? ??? ??? ????? ????? ????? ???????? ?? ????? ?????? ? ???????? ???? ? ????????? ??????.

???????????? ? ?? ???? ??? ?????????? ?? ????????? ?????/?????? ????? ?????????? "Obj"

?????????

? ??? ???? ??? ????? ????? ?????????? ?????? ?? ???? ???? ???????? ???? GetSheetObject ? ?.?.

sparur
Specialist II
Specialist II

I don't sure that your approach is simplier, but if you want you can to use it.

Try to find some functions for class TableBox (see in APIguide.qvw), for example getCell, getCells etc. May be you can to find useful functions for your solution.

---

?? ?????? ??? ????? ????????? ????? ??? ??????, ???? ???? ???? ????? ???????? ????? ????? ??????????? ?????????? (?.?. ???-?? ???? ?????????????? ???????, ? ?? ?????? ?????????? ????????? ????? ?????, ????????? ? ?????????? TableBox), ?? ???????? ??? ????? ??????? ?????? ??? ??? ?? ???????????. ?????? ??????? ?????? TableBox, ITablebox*.

??? ???? ?? API ????????? ? ??????????? ?????. ??????? ??? 🙂 ?? ??? ? ???????? ??? ????????? ??????? 🙂

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Simplicity, my friends, will save the world!. Can you step back and explain in simple terms what exactly you are trying to accomplish? I'm sure there is a better way.

If I understand you correctly, you need to look at everything related to the Class IRCCell. Here is an example from the APIGuide:

set TableBox = ActiveDocument.GetSheetObject( "TB01" )
set cell = TableBox.GetCell(0,0)
set x = cell.Text

------

Prostota spaset mir!