Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Updating field from Inputfield

Hello guys,

Would you please help me with this.

I have a table with 3 fields

     Order_No

     Comments     inputfield

     _Comment2     this field is used in a pivot table because I can not use the inputfield to group the rows.

I want to change the value of the inputfield  and update the _Comment2 field for the current Order_No.

I've been trying with some lines with out success.

1.-

     ActiveDocument.DynamicUpdateCommand("Update MyTable SET _Comment2 = Comments Where Order_No='1'")

but not working.

2.-

Declaring variable into settings as sMyVar and the default value with =Comments, and on the trigger section I added Set Variable for the Comment field OnChange action like, Variable sMyVar and Value =Comments.

In a macro code:

     set vValor = ActiveDocument.Variables("sMyVar")

     MsgBox ( vValor.GetContent.String)     '(here i get an error "Object required vValor" and stops macro)

     ActiveDocument.DynamicUpdateCommand("Update MyTable SET _Comment2 = '"&vValor&" Where Order_No='1'")

-----------------------------

I'll appreciate all kind of help about this issue.

Thanks

Karim

1 Solution

Accepted Solutions
fosuzuki
Not applicable

Re: Updating field from Inputfield

QlikView treats each inputfield's value as unique, and as you've already discovered, it will not group the values.

In your load script, you can create your table using the Order_no and Comments fields, and declaring the Comments field as an inputfield. In the pivot table, instead of using the Comments field as your dimension, use a calculated dimension as: text(Comments). This cheat will make QlikView override the default inputfield behaviour an it will behave as a standard field, grouping the equal values!

Hope you understand it!

Fernando

5 Replies
fosuzuki
Not applicable

Re: Updating field from Inputfield

Hi Karim,

I think you can use an inputfield in a pivot table dimension.

Check my attached sample.

Hope this helps you.

Regards,

Fernando

Not applicable

Re: Updating field from Inputfield

Hi Fernando,

I can't open your sample, becaus I am using a personal edition.

Can you explain it. ?

Thanks.

Karim

fosuzuki
Not applicable

Re: Updating field from Inputfield

QlikView treats each inputfield's value as unique, and as you've already discovered, it will not group the values.

In your load script, you can create your table using the Order_no and Comments fields, and declaring the Comments field as an inputfield. In the pivot table, instead of using the Comments field as your dimension, use a calculated dimension as: text(Comments). This cheat will make QlikView override the default inputfield behaviour an it will behave as a standard field, grouping the equal values!

Hope you understand it!

Fernando

Not applicable

Re: Updating field from Inputfield

Hi Fernando,

Thanks for your help, thats what I am lookin for.

After your answer, I tried with = before the inputfield and works same as Text function.

Then, to group the inputfields as dimension in charts:

=Text(inputfield)     or

=Inputfield

Thanks again.

Karim

eruditio
Not applicable

Re: Updating field from Inputfield

Many thanks Fernando, this is brilliant