Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: Empty Column With 0 as Value

$
0
0
Re: Empty Column With 0 as Value
FoxInCloud
Re: Empty Column With 0 as Value
Mar. 20, 2013
05:55 am
3QQ0CP6OKShow this entire thread in new window
Gratar Image based on email address
From:FoxInCloud support
To:Michele
Ciao Michele,

This patch should bring your application the expected support

modify command awHTML

Replace:
awHTMLgen.getHTML_grd_AW_cScript_txt()
awHTMLgen.getHTML_grd_AW_cScript_txt_cFmtY()
awHTMLgen.cDTFormat()

With the following code:

thanks,

* ----------------------------------------------PROTECTEDFUNCTION getHTML_grd_AW_cScript_txt && Script de réglage d'un contrôle Textbox dans une colonneLPARAMETERS ; tcCol,; && N° de colonne en caractères toControl AS TextBox,; && Contrôle tcType && Type de .ControlSourcethis.nDataSessionID = Set("Datasession")SETDATASESSIONTOthis.oForm.DataSessionID#IF NOT DEBUGMODETRY#ENDIF tcType = Evl(m.tcType, Type(m.toControl.ControlSource)) && fonctionne seulement dans la session de données du formulaire LOCAL lcFormat, lcMask, lcResult lcResult = '' lcFormat = Upper(Evl(m.toControl.Format, m.toControl.Parent.Format))#IF .F. .Format - TYPE ALL R Displays the format mask for the textbox that is specified in the InputMask property. The mask formats data for easier entry and clearer display. For example, if the mask is 99-999, the number 12345 is displayed as 12-345 but is not stored as part of the data. Use only with Character or Numeric data.#ENDIF lcMask = Iif('R' $ m.lcFormat; , Chrtran(Evl(m.toControl.InputMask, m.toControl.Parent.InputMask), Chr(160), ' '); , ''; ) tcType = Iif('D' $ m.lcFormat, 'D', m.tcType)DOCASE#IF .F. .Format - TYPE C ! Converts alphabetic characters to uppercase. Use with data of Character type only. A Allows alphabetic characters only with no spaces or punctuation marks. F Prevents Varchar values from being padded with trailing spaces in text boxes or Varbinary values from being padded with trailing zeroes (0s). NotesFortext boxes boundto data with Varchar type, the MaxLength property must be setto a nonzero valueto permit inputfor the desired number of characters.When you drag a fieldwith Varchar typeto a form, the created textbox's Format property is set to "F", and the MaxLength property is set to the maximum length for the Varchar field. When you drag a Grid control to a form and create TextBox controls for columns with Varchar type, the Format property is set to "F", and the MaxLength property is set to the maximum length for the Varchar field.When you drag a fieldwith Varbinary typeto a form or when you drag a Gridcontrolto a form and createTextBox controls for columns with Varbinary type, the following occur:Format property is setto "F".MaxLength property is setto the maximum length multiplied by 2 for the Varchar field.InputMask property is filled with "H" up to the value of the MaxLength property. T Trims leading and trailing blanks from the inputfield.#ENDIFCASE m.tcType $ 'CM' *!* Keep AW default *!* See if a property should be added to awPublic.prg!awGrc to display as string (HTML tags not interpreted) *!* TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPretext && GetTimeZone(): Timezone offset in milliseconds && serveur et client sont dans le même fuseau horaire *!* var fmt = new AW.Formats.HTML; *!* ENDTEXT #IF .F. .Format - TYPE D D Uses the current SETDATEformat. E Edits Date values as British dates. YS Displays Date values in a short dateformat determined by the WindowsControlPanel short date setting. YL Displays Date values in a long dateformat determined by the WindowsControlPanel long date setting.#ENDIFCASE m.tcType == 'T'TEXTTO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPretext && GetTimeZone(): Timezone offset in milliseconds && serveur et client sont dans le même fuseau horaire var fmt = new AW.Formats.DateTimeVFP; fmt.setDataTimezone(<<Int(GetTimeZone() * -60 * 10^3)>>); fmt.setTextTimezone(0); fmt.setDataFormat('ISO8601'); fmt.setTextFormat('<<this.getHTML_grd_AW_cScript_txt_cDTfmt(.T.)>>');ENDTEXTCASE m.tcType == 'D'TEXTTO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPretext var fmt = new AW.Formats.DateVFP; fmt.setDataFormat('ISO8601'); fmt.setTextTimezone(0); fmt.setTextFormat('<<this.getHTML_grd_AW_cScript_txt_cDTfmt()>>');ENDTEXT#IF .F. .Format - TYPES NY $ Displays the currency symbol. The ControlSource property must specify a numeric source for the textbox. ^ Displays numeric data using scientific notation. The ControlSource property must specify a numeric source for the textbox. L Displays leading zeros instead of spaces in the textbox. The ControlSource property must specify a numeric source for the textbox.#ENDIFCASE m.tcType == 'Y' OR '$' $ m.lcFormatTEXTTO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPretext var fmt = new AW.Formats.Number; fmt.setTextFormat('<<this.getHTML_grd_AW_cScript_txt_cYfmt()>>');ENDTEXTCASE m.tcType == 'N'IFEmpty(m.lcMask) lcResult = '###'ELSE lcResult = Chrtran(m.lcMask, "9", "#")IF NOT Set("Point") $ m.lcResultLOCAL liPoint liPoint = Ratc('#', m.lcResult) lcResult = Iif(m.liPoint > 0; , Stuffc(m.lcResult, m.liPoint, 0, Set("Point")); , m.lcResult; )ENDIFENDIFTEXTTO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPretext var fmt = new AW.Formats.Number; fmt.setTextFormat('<<m.lcResult>>');ENDTEXTENDCASE#IF .F. .Format - TYPE ALL K Selects all the textwhen the controlgets the focus. R Displays the format mask for the textbox that is specified in the InputMask property. The mask formats data for easier entry and clearer display. For example, if the mask is 99-999, the number 12345 is displayed as 12-345 but is not stored as part of the data. Use only with Character or Numeric data. Z Displays the value as blankif it is 0, except when the control has focus. Dates are also supported in these controls. The / / datedelimiters are not displayed unless the control has focus.#ENDIFIF .T.; AND 'Z' $ m.lcFormat; AND m.tcType $ 'TDNY'TEXTTO lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPretext<<m.lcResult>> fmt.dataToText_ = fmt.dataToText; fmt.dataToText = function(data){return<<Iif(m.tcType $ 'NY', [parseInt(data)], [data])>> ? this.dataToText_(data) : ''; };ENDTEXTENDIF#IF NOT DEBUGMODECATCHTO loExceptionTHROW m.loException && renvoyé à this.getHTML() FINALLY * Revenir à la session de données initiale SETDATASESSIONTOthis.nDataSessionIDthis.nDataSessionID = 0ENDTRY#ELSE * Revenir à la session de données initiale SETDATASESSIONTOthis.nDataSessionIDthis.nDataSessionID = 0#ENDIFRETURNIif(Empty(m.lcResult); , ''; , m.lcResult; + CRLF; + Textmerge([setCellFormat(fmt, <<m.tcCol>>);]); + CRLF; ) * ---------------------------------------------- PROTECTEDFUNCTION getHTML_grd_AW_cScript_txt_cYfmt && format pour les monétaires LOCAL llLeft, lcCurrency llLeft = Set("Currency") == 'LEFT' lcCurrency = Set("Currency", 1)RETURNChrtran(''; + Iif(m.llLeft, m.lcCurrency, ''); + '#'; + Set("Separator"); + '###'; + Iif(Set("Decimals") > 0; , Set('POINT') + Replicate('#', Set("Decimals")); , ''; ); + Iif(m.llLeft, '', m.lcCurrency); , Chr(160); && activeWidget n'aime pas ce caractère ... , ' '; )* ----------------------------------------------PROTECTEDFUNCTION getHTML_grd_AW_cScript_txt_cDTfmt && Format de date ou date et heure pour ActiveWidgetLPARAMETERS tlT && [.F.] Format de date et heureLOCAL lcDate lcDate = Set('DATE')RETURN''; + ICase(; m.lcDate == 'ANSI', 'yy.mm.dd',; m.lcDate == 'AMERICAN', 'mm/dd/yy',; m.lcDate == 'BRITISH', 'dd/mm/yy',; m.lcDate == 'FRENCH', 'dd/mm/yy',; m.lcDate == 'GERMAN', 'dd.mm.yy',; m.lcDate == 'ITALIAN', 'dd-mm-yy',; m.lcDate == 'JAPAN', 'yy/mm/dd',; m.lcDate == 'TAIWAN', 'yy/mm/dd',; m.lcDate == 'USA', 'mm-dd-yy',; m.lcDate == 'MDY', 'mm/dd/yy',; m.lcDate == 'DMY', 'dd/mm/yy',; m.lcDate == 'YMD', 'yy/mm/dd',; m.lcDate == 'SHORT', 'dd/mm/yy',; && /!\ à approfondir m.lcDate == 'LONG', 'dd/mm/yyyy',; && /!\ à approfondir'dd/mm/yyyy'; ); + Iif(Vartype(m.tlT) == 'L' AND m.tlT; , Space(1) + Iif(.F.; OR m.lcDate $ 'SHORT,LONG'; && à approfondir OR Set("Seconds") == 'ON'; , 'hh:mm:ss'; , 'hh:mm'); , Space(0); )


Normally in VFP when i want a column with numeric values to be empty when the value i s zero i put into the Format property Z. In FIC i put Z in format but i continue to see the 0,0000.....
How can i do to prevent the zero to be shown in browser ?


Thierry Nivelet (FoxInCloud)
Never explain, never complain (Queen Elizabeth II)


Viewing all articles
Browse latest Browse all 10393

Trending Articles