Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
sibrulotte
Creator III
Creator III

Converting numbers to text, 1 = one ...

Hi,

so I would like to show the number of periods as numbers spelled out for proper presentation. To top it off, in french!

I loaded inline this table as a data island: 

Chiffres:

Load * inline [
Chiffremois, Nombremois
1, un
2, deux
3, trois
4, quatre
5, cinq
6, six
7, sept
8, huit
9, neuf
10, dix

11, onze
12, douze
]
;

So you know, that's pretty french, but you can figure out what the english version is...

I figured I'd do a plain set analysis like this get back my "Nombremois"  

but it's not working out.

=Only({<Chiffremois=[Période financière]>} Nombremois)

BTW,  [Période financière] by itself gives me a 9 in a text box. No alternative states are involved.

Yet I still can't get it to return 'neuf' ...

Anybody want to contribute/lend a hand?

1 Solution

Accepted Solutions
stephencredmond
Luminary Alumni
Luminary Alumni

I guess that I am still not exactly sure what it is that you want to achieve.

If you look at the attached application, it shows some playing with disconnected data using Set Analysis.  I don't know if it is close to what you want.

Perhaps, if you step back from the specific problem and describe what you want to have happen then we can recommend a good approach?

Regards,

Stephen

View solution in original post

15 Replies
MK_QSL
MVP
MVP

=Only({<Chiffremois=['Période financière']>} Nombremois)

or

=Only({<Chiffremois=["Période financière"]>} Nombremois)

or

if Période financière is variable

=Only({<Chiffremois=['$(=Période financière)']>} Nombremois)

chiru_thota
Specialist
Specialist

=Only({<Chiffremois=[Chiffremois]>} Nombremois)

Converting numbers to Words.jpg

PrashantSangle

Hi,

You can do this at script level

rename your field

[Période financière] as Chiffremois

so that your table link with inline table

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
maxgro
MVP
MVP

why not a dual for your [Période financière]?

from online help

dual( s , x )

Association forcée d'une représentation de chaîne arbitraire s à une représentation numérique donnée x. Dans QlikView, lorsque plusieurs éléments de données lus dans un champ ont différentes représentations de chaîne mais la même représentation numérique valide, ils partagent tous la première représentation de chaîne rencontrée. Cette fonction peut s'utiliser aussi bien dans les scripts que dans les expressions de graphique.

Dans les scripts, la fonction dual s'emploie généralement relativement tôt dans le script, avant que d'autres données ne soient lues dans le champ concerné, afin de créer cette première représentation de chaîne qui sera affichée dans les listes de sélection, etc.

Remarque :
Si une valeur dual est trop grande pour tenir dans un objet de type champ, elle est représentée par des signes ## au lieu d'être tronquée et représentée par des points de suspension (...) comme une chaîne.

Exemple (dans un script) :

Load dual ( string,numrep ) as DayOfWeek inline

[ string,numrep

Monday,0

Tuesday,1

Wednesday,2

Thursday,3

Friday,4

Saturday,5

Sunday,6 ];

load Date, weekday(Date) as DayOfWeek from afile.csv;

Cet exemple de script génère un champ DayOfWeek avec les jours de la semaine écrits en toutes lettres. QlikView considérera toujours ce champ comme un champ numérique.

Miguel_Angel_Baeyens

Hi,

Yes, Dual() is the best option to get what you want. You can load it INLINE or from a table or a file.

Miguel

sibrulotte
Creator III
Creator III
Author

Thank you for the cue.

When I load this:

 

Chiffres:

Load * inline [
Période financière, Nombremois
1, un
2, deux
3, trois
4, quatre
5, cinq
6, six
7, sept
8, huit
9, neuf
10, dix
11, onze
12, douze
]
;


CalendrierComptable:
LOAD
[Année financière],
dual(ApplyMap('Chiffres', [Période financière]),[Période financière] ) as [Période financière]

From $(QVDDir)\CalendrierComptable.qvd (

qvd);


This returns nulls for Période financière in my Calendar. what am I missing...

My number is Période financière, my text is Nombremois, mapped through Chiffres using Période finaicière.

Got it.

Well I guess I didn't get it that well...

maxgro
MVP
MVP

to use ApplyMap you need a special load, a Mapping load

Chiffres:

Mapping Load * inline [
Période financière

..........




A.png

sibrulotte
Creator III
Creator III
Author

Yes in deed, thank you.

Do you know a way around arythmetic functions done to that field?

I.e Text(Période financière - 1), will not return the text but the number...

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

For this you will need a variable that receives a parameter that then looks up the text.  If you search for QlikView Parameters with Variables you should find info on this, I know Stephen Redmond did a good article on this a while back.

The variable would need to contain:

='maxstring({<Integer={'$1'}>}StringNumber)'

Where, you have a data island of integer and strings.  The variable call will be like:

=$(vIntToString(10))

Not too sure how this will behave if you put an expression in here though, eg:

=$(vIntToString([Période financière] - 1))

My gut feel is that it will not work though.  An interesting problem!