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

Use new create field to create another field in the same script

Hi, I have problem with using the new create field  "Tender" to create another field "PEP".

Date([Start Date]) as "Start",

Date([End Date]) as "End",

Date(IF([Start Date]='', (''), AddMonths([Start Date],-4) ) )as "Tender",


Date(IF([Budget Type]=('CAPEX'), IF([Tender]=(''), (''), AddMonths([Tender], -3) ), ('') )) as "PEP"

Capture.PNG


And it is possible to use rename field with the new name? for example instead of:

Date(IF([Start Date]='', (''), AddMonths([Start Date],-4) ) )as "Tender", can i use Date(IF([Start]='', (''), AddMonths([Start],-4) ) )as "Tender"?




5 Replies
undergrinder
Specialist II
Specialist II

Hi Lingling,

Date(IF([Budget Type]='CAPEX', IF([Tender]='', '', AddMonths([Tender], -3)),'')) as PEP

The quotation marks is obligate when you have two or more word long column name, at this case with "PEP" refer an existing column, PEP refer to alias.

G.

Not applicable
Author

Sorry, I don't get it:( I am trying to know is it possible to use new create field  to create another field?

for example, i use formula to generate a new field known as "Tender", then i would like to create another field which make use of the "Tender"  field?

sasiparupudi1
Master III
Master III

use a preceding load as you can not refer to an expression as a field in the load

Table:

load *,

Date(If([Budget Type]='CAPEX', if(Tender='', '', AddMonths([Tender], -3) ), '' )) as "PEP";

LOAD *,

    Date([Start Date]) as "Start",

    Date([End Date]) as "End",

    Date(If([Start Date]='', '', AddMonths([Start Date],-4) ) )as Tender;

LOAD * INLINE [

    Budget Type,Start Date,End Date

    CAPEX        

];

sasiparupudi1
Master III
Master III

Short answer is NO

you can not refer the expression -> Date(IF([Start Date]='', (''), AddMonths([Start Date],-4) )


in another expression

undergrinder
Specialist II
Specialist II

Yes, sorry, I didn't noticed, that the Tender field is created in the same statement.

G.