Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to change the Standard format and once update the charts

Hi all,

We want to use the same qvw-file for multiple users. And each has his own Format. So I have to change the Standard formats.

SET ThousandSep='.';
SET DecimalSep=',';
SET MoneyThousandSep='.';

.

.

.

(The new Information is coming from the database and it works (such like LET DecimalSep=peek('GlobalDecimalSymbol',0,SystemSetting);

))

Now there is the problem, that changing the Format to an existing file,

the Charts are not updated.

They only are updated if you change the Settings, deactivate the Format and activate it again, and this you have to do for each Chart.

Someone had the same problem in this thread:

Number Format Setting Separators, Decimal and Thousand not defaulting to values from ThousandSep an...

The solution was to write a makro.  Does anyone have another idea? Does this makro really do his Job? I´m not yet very fit in writing makros. 😞

Thanks very much.

8 Replies
Gysbert_Wassenaar

The alternative is to use the Num() function in the expressions. You can then also define a variable with the format that should be applied and use that in the Num() function:

Num(sum(Amount), $(vMyFormatStringVariable) ).


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert,

thanks for your reply. I know about the num-function, but in this case I wanted to change the Standard.

jagan
Luminary Alumni
Luminary Alumni

Hi,

In expression you can format the numbers like below

=Num(Sum(Sales), 'Your format goes here')

and now in Number tab uncheck Override document settings

Regards,

Jagan.

marcus_sommer

You might use a macro like the following one but I wouldn't recommend it really then it's difficult to determine to which fields it should be really applied and to which not. There are many places where it could have side-effects like set analysis or already used converting/formating-functions.

We have used it and the efforts to find the errors (after the first one or two I knew I had created a problem) and checking/repairing all possible other places needed at least so many time as changing everything manually.

function fixFields(){

    var fields=ActiveDocument.GetFieldDescriptions();

    for(var i=0; i<fields.Count; i++){

        var fd=fields.item(i);

        if(!fd.IsSystem && !fd.IsHidden){

            var f=ActiveDocument.GetField(fd.Name);

            var props=f.GetProperties();

            if(!props.NumberPresentation.Type){

                var tags=fd.Tags;

                for(var j=tags.lbound();j<=tags.ubound();j++){

                    switch(tags.getItem(j)){

                        case "$integer":

                            props.NumberPresentation.Type=10;

                            break;

                        case "$ascii":

                        case "$text":

                            props.NumberPresentation.Type=1;

                            break;

                        case "$numeric":

                            props.NumberPresentation.Type=2;

                            break;

                        case "$time":

                            props.NumberPresentation.Type=4;

                            break;

                        case "$timestamp":

                            props.NumberPresentation.Type=5;

                            break;

                        case "$date":

                            props.NumberPresentation.Type=3;

                            break;

                    }

                   

                }

                props.NumberPresentationSurvive = true;

                f.SetProperties(props);

               

                //ActiveDocument.GetApplication().MsgBox(fd.Name+" - " +props.NumberPresentation.Type);

            }

        }

    }

}

- Marcus

markus19-85
Partner - Contributor III
Partner - Contributor III

Hi,

are there any updates on this issue?

marcus_sommer

The real magic is to consider the format-stuff and similar things like different languages and so on before you creates the application. The need to change anything after them will be always require some time and efforts and be more or less painful ... and also if it's an ugly job the manually change is often the fastest way.

- Marcus

markus19-85
Partner - Contributor III
Partner - Contributor III

Hi Marcus,

this could be difficult if you have a global application with different number formats. It could be so easy if the ThousandSep variable updates automatically in the charts after changing.

You are from Germany? Can I contact you for a personal discussion?

Markus

marcus_sommer

Hi Markus,

I'm not sure if an automatically change of all formattings would be really desirable but of course I would like an easier way to change such things. Possible alternatives could be to export the document layout (or using the objects within the prj-folders) and doing there the replacements within an editor and importing it again.

You could contact me over the mail in my profil here or per Xing/LinkedIn.

- Marcus