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

Number Formatting Issue

Hi,

I am currently working on an excel sheet comparing numbers that are assigned to different field values in order to create logical data. The numbers are typically formatted as ex. 2938 or 20098. There are a couple of numbers that contain a R or a P at the end indicating that they are in rework or if they are a project. In the script I have tried using Num(Num#([WR #], '#####','R')) in the script. [WR #] is the field that contains those numbers. Without this, I cannot see a number like 20920R or 1097P. Using the Num function, I am able to at least see the number itself, but it does not contain the R or P, which is critical to my data. If anyone knows how to fix this, it would be very helpful.

Thanks!

27 Replies
Not applicable
Author

Hope this helps.The other tabs in my script come from other excel files that I do not have access to, but this is what my excel sheet looks like simplified and using simplistic data.

swuehl
MVP
MVP

Rob's suggestion seems to work for me - with your sample data:

LOAD Dual([WR #],PurgeChar([WR #],'PR')) as Test,

*;

LOAD [WR #],

    Developer,

    [Date Assigned],

    [Estimated Project Hours],

    [Actual Hours Spent]

FROM

(ooxml, embedded labels, table is Sheet1);

2016-06-15 19_40_21-QlikView x64 - [C__Users_Stefan_Downloads_comm220839.qvw].png

If this is not working for you, I guess that's due to the other data source you are loading.

Could you outline how your script is loading in your [WR #] records?

Have you considered what I mentioned above about the text representation of dual values being limited to the first representation of a value encountered during LOAD?

Not applicable
Author

Sorry, I am new to Qlikview, but I don't think dual is the right thing to use in this situation. I am already left joining one table to another. Both WR and WSR have the same WR IDs, but WSR has additional information that I need to join to WR. Both of these WR ID fields have numbers like 2134,21134,1231R,12452R,2142P and 21234P. I need all of the WR ID to show both the number and the letter at the end.

QUALIFY *;

UNQUALIFY [WR ID];

WR:

LOAD

   [Request Number] AS [WR ID],

   Status,

   [Assigned Date]

     . . .

From

;

QUALIFY *;

UNQUALIFY [WR ID], [Assigned Date],

WSR:

Left JOIN ([WR])

LOAD

  Num#([WR #], '#####','R') as [WR ID],

    Developer,

    [Date Assigned],

    [Estimated Project Hours],

    [Actual Hours Spent]

     . . .

From

;

swuehl
MVP
MVP

Just to clarify, you may also use dual values without using dual() function:

Data Types in QlikView

Have you tried just loading in your values as they are? or using text() function?

Not applicable
Author

When I have tried loading them as they are, all of them except the ones with letters appear. That's why I originally did the num function to at least get the number to appear without the letter. I tried the text() function and none of the numbers appeared on my dashboard.

swuehl
MVP
MVP

You would need to apply text() to both table loads.

I assume you are trying to join an ID in WSR table like 2134R to and ID in WR table like 2134, is this correct?

If so, do ID 2134 appear next to 2134R in WSR table and you need to handle these differently?

If not, try to purge the letters from your ID field in WSR table and store the additional information into an addtional field:

WSR:

Left JOIN ([WR])

LOAD

  Purgechar([WR #], 'PR') as [WR ID],

  KeepChar([WR #], 'PR') as [WR ID info],

    Developer,

    [Date Assigned],

    [Estimated Project Hours],

    [Actual Hours Spent]

     . . .

From

;

Sorry for being still not really sure what you are trying to achieve.

Stefan

Not applicable
Author

Yes I am trying to join an ID like 2143R in the WSR table to the same ID in the WR table but the one in the WR table does not have an R. I need to handle these numbers as if they are identical. They have the same developer, assigned date, project hours, etc. I see what you are trying to do there in the code, but that unfortunately did not work in the script as well. It got rid of all the numbers except one.

swuehl
MVP
MVP

You can only JOIN or link key fields based on matching values.

2143 and 2143R are not same, matching values.

You would need to create a set of matching values based on something like I tried above (you would need to check if values are matching given your data).

If you are using multiple keys for JOIN / linking of tables, all these fields need to match to successfully create your link / join. Maybe your issue is also related to not matching values e.g. in date / timestamp / developer fields.

swuehl
MVP
MVP

I would also suggest that you link your tables using the key fields instead of joining them, for debugging puporses.

Then create a table box with the key fields and another field from both tables WSR and WR.

(You can also look at each key field separately first)

No you should see which values match and which don't, this might give you some additional insight why the join doesn't work.

effinty2112
Master
Master

Hi Caitlin,

Data:

LOAD

  [WR #],

  PurgeChar([WR #],'PR') as [Numeric WR #],

  KeepChar([WR #],'PR') as [Alpha WR #],

     Developer,

     [Date Assigned],

     [Estimated Project Hours],

     [Actual Hours Spent]

FROM

[Sample WR sheet.xlsx]

(ooxml, embedded labels, table is Sheet1);

Will give you:

WR # Numeric WR # Alpha WR # Actual Hours Spent Date Assigned Developer Estimated Project Hours
2451P2451P3608/01/2015Bob34
2458R2458R3026/02/2014Jane22
59225922 4003/12/2011Paul45
23648R23648R10205/06/2016Bob80
24514P24514P5405/11/2015Jane68
2547825478 2109/08/2013Paul15
4578445784 9518/03/2015Paul105