Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

InputField

Hey Community,

Im using on my model whit InputField the problem is that i cant rest the data on the field every time i make reload to the original data that came from the data source.

p.s my client dont want duplicate field ex (Original Field and InputField )

Can anyone have idea for me how can i do this ?

Thanks

David.

1 Solution

Accepted Solutions
moleroalonso
Contributor II
Contributor II

You can use a macro like this:

Sub ResetInputField

' Reset the InputField

  set fld = ActiveDocument.Fields("HaderaQty")

  fld.ResetInputFieldValues 0,  0   ' 0 = All values reset, 1 = Reset Possible value, 2 = Reset single value

End Sub


Macro extracted from: Useful Qlikview Macros

View solution in original post

9 Replies
Gysbert_Wassenaar

You'll have to reload the document twice. The first time you immediately exit the script so the document is reloaded without data. This will also clear the persistent input field values. Then the next reload loads the original date from the excel file. You can pass a variable value as parameter with the command line options: qv.exe /r /vvClear=1 MyDoc.qvw. That way you can create a batch script that will reload the document twice and clear the data on the first run.

IF vClear=1 THEN
     set vClear=0;
     
exit script;
ENDIF

INPUTFIELD  HaderaQty;

Data:
LOAD
     Country,
    
Supplier,
    
S.Terms,
    
C.Status,
    
HaderaQty,
    
HaderaQty As H.Qty   
FROM
      datafields.xlsx
      (
ooxml, embedded labels, table is Simulation)
      ;


talk is cheap, supply exceeds demand
moleroalonso
Contributor II
Contributor II

You can use a macro like this:

Sub ResetInputField

' Reset the InputField

  set fld = ActiveDocument.Fields("HaderaQty")

  fld.ResetInputFieldValues 0,  0   ' 0 = All values reset, 1 = Reset Possible value, 2 = Reset single value

End Sub


Macro extracted from: Useful Qlikview Macros

Anonymous
Not applicable
Author

Thank you  but i didn't understand how to do this, i need every reload reset my data

Gysbert_Wassenaar

Yes, I understood you. And my answer is that you need to reload that document twice each time you want to reset the inputfield values and load the original date. The first reload is done with a variable vClear set to 1 so the script excecution is terminated in the IF-ENDIF block. The document will then be saved without data. The persistent inputfield values will be cleared too. A regular reload won't do this. That is why you need this first reload. Then the second reload directly after the first will load the data from the excel file and effectively reset the input field values. See attached example.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Thank you for your help i wish i could do it on one reload,

My app is connected to sql server and i do reload one time in a day on qlikview server and this need to be manually

Gysbert_Wassenaar

That depends. If you have Publisher you can schedule two tasks for the same document. If you don't have Publisher you could use a batch file to reload the document twice using a Windows scheduled task.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Thank you so much this is work perfect as i wanted !!! *****

Anonymous
Not applicable
Author

If i want more then one field what will be the syntax at the macro And to change field whit 0 value ?

ancient_grape
Contributor
Contributor

I know this thread is ancient, but I just wanted to say thank you for this solution as it saved my life.

I was tearing my hair out due to the "reset values" bug that still exists in 11.20 SR20 (which causes zero-byte files to be saved after resetting inputfield values) and was looking for a solution to help my users.

Your "double-reload" solution did the trick exactly - thank you again!