Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

MaxString() function has an issue

Hi,

I am trying to achieve the max of the Program using Maxstring(). It works for most of the projects. but for this scenario it gives an incorrect output.

Expected Output is  B2700.18

But the output showing in the QV chart is B2700.8.

Max.PNG

Is there any way I can fix this issue.

13 Replies
kamielrajaram
Creator III
Creator III

Hi,

Is the field always going to have a number after the point. If so you can try subfield(ID,'.',2) as ID_Order and use this the get the max number.

Kind Regards

Kamiel

Clever_Anjos
Employee
Employee

Excel has the same behaviour , because alphabetically 14,17,18 comes before 2

Capturar.PNG

maybe you can prepare your data appending a '0' before numbers with only one char

Clever_Anjos
Employee
Employee

Maybe using KeepChar(ID,'0123456789.') could sort in a way you need

Anonymous
Not applicable
Author

Hi Kamiel,

The subfield works good if we are having a number after the decimal. i.e B2700.2, B2700.3

but I also have the data which has the value it self i.e B2700.

Can you help me on how this works.

Thanks,

SP

Anonymous
Not applicable
Author

Hi,

While using this logic,

I would have an issue as I would also have numbers before the decimal as well,

Is there any other way to approach this?

Thanks,

SP

Colin-Albert

Try sorting on  subfield(ID, '.', 1) & num(subfield(ID, '.', 2) / 1000, '.0000')

You can add this as a column to your chart to test.

Colin-Albert

Maxstring is correctly sorting alphabetically.

This will work  (I'm unable to edit the previous reply)

subfield(ID, '.', 1) & num(subfield(ID, '.', 2) / 100, '.00')

Anonymous
Not applicable
Author

This partially works but modifies the initial data from B2700.18 to B27000.18

alis2063
Creator III
Creator III

You can get the desire result based on inbuilt sorting function'Sort'i n QlikView ,You just  need  to transform  data as i.e 2700.18, 2700.18 and put it one variable then use it variable in Sort section .



Hope it will works...